1

I tried to create a service to launch an app as a service with srvstart.exe using this syntax

SC CREATE myapp DisplayName= "myapp" binPath= “srvstart.exe myapp -c E:\Systema\myapp\myapp.ini” start= auto

where myapp.ini is

[myapp]
startup=”E:\Systema\myapp\myapp.exe”
shutdown_method=winmessage

but whenever I try to start the service I get this message

THE myapp SERVICE ON LOCAL COMPUTER STARTED AND THEN STOPPED.SOME SERVICES STOP AUTOMATICALLY IF THEY ARE NOT IN USE BY OTHER SERVICES OR PROGRAMS

Have I done something wrong? Is there any other way to create a simple background service of an exe?

3

Oh, I just found http://nssm.cc/ and it works seamlessly and it's only:

nssm install myapp

and a nice gui do the rest of the work.

PD: I suspect than srvstart is just for winxp and SC do the work itself (the hard way)

0

I tried this on a Windows2012 R2 version and it works ;-)

How To Create a User-Defined Service

  • Install the Windows Server 2003 Resource Kit Tools
  • C:\Program Files\Resource Kit\Instsrv.exe Notepad C:\Program Files\Resource Kit\Srvany.exe
  • Run Regedit andn go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\
  • From the Edit menu, click Add Key.

    Key Name: Parameters

  • Select the Parameters key
  • From the Edit menu, click Add Value.

    Value Name: Application Data Type : REG_SZ String : C:\Windows\notepad.exe

  • Then start the service :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.