I’ve had to deal with this today, so I thought I might just as well post it in my blog, since someone else might find it useful. The thing you want to do is run an application as a system service, so that it starts automatically without you having to log on. There are many commercial solutions out there, but there’s also a very cheap, free and fast one available for you.

The Windows NT/2000 Resource Kit provides two utilities that allow you to create a Windows user-defined service for Windows applications and some 16-bit applications (but not for batch files). They are called Instrsrv.exe (installs and removes system services from Windows NT/2000) and Srvany.exe (allows any Windows application to run as a service). You can download them here, along with a text file describing the usage of srvany.exe in detail.

Now, for a step-by-step tutorial on how to make a certain application run as a service.

  • First, open a command prompt. Make sure the Services Manager window is closed while running the DOS commands. You will need to put the two files above in a directory called c:\reskit (you can use any other directory and path for that).
  • At the MS-DOS command prompt (Start | Run | cmd.exe), type the following command:
    c:\reskit\INSTSRV.EXE “Service Name” c:\reskit\SRVANY.EXE
    This creates the service in the Services manager and the registry keys to setup what program to run.
  • Next open regedit.exe (Start | run | regedit.exe)
  • Navigate to this registry key:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\service name
  • From the Edit menu, click Add Key and name it Parameters
  • Next from the Edit menu, click Add Value and type this information:
    Value Name: Application
    Data Type : REG_SZ
  • Edit the string value and enter the full path + the application name you want to run as a service there.
  • Now you can start your service from the Service Manager :)
  • With this same program you can also remove the service. Just run this command from command prompt:
    c:\reskit\INSTSRV.EXE “Service Name” REMOVE