How to Install an executable as a Windows Service

Solution 1:

I don't know about Windows 7, but the SC and SrvAny utilities from the Windows Server 2003 resource kit still worked on Server 2008 the last time I checked; I've used this technique myself to get PDFCreator running as a service on our file/print box:

  • Grab "srvany.exe" from the Server 2003 Resource Kit and copy it to your Server 2008 box.

  • Use "sc" to create a new service that launches "srvany":

sc create NewService binPath= C:\Windows\System32\srvany.exe DisplayName= "My Custom Service".

(Those spaces between the equal sign and the value are actually required by SC. No, I don't know why either.)

  • Use Regedit to create a key called "Parameters" in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NewService\Parameters). Inside that key, create a string value called "Application" and enter the full path to the application you are wanting to run as a service.

  • Cross fingers, start service.

Solution 2:

Srvany will do the basic job of running your executable as a service but be careful as it falls short in some areas. Check out this page comparing Srvany to our commercial alternative for the details.