Sometimes you’ll run across an instance where a particular program you need to run as a service, instead of launching every time someone logs in (server applications are a good example).
These are the files that you’ll need for Windows 2000-2003:
- Instrsrv.exe – This installs and removes system services.
- Srvany.exe – This allows any Windows application to run as a service.
You can download both files here: srvany.zip
First you’ll need to goto the path within the command prompt (Start > Run > cmd.exe) to where you unzipped the attached files, and then run:
instsrv.exe "My Service Name" c:\FULL_PATH\TO\srvany.exe
This function creates the appropriate windows registry entries.
Next you’ll want to start the registry editor and enter the appropriate values (Start > Run > regedit.exe). WARNING: Editing the registry runs the risk of disaster. Continue at your own risk.
- Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\My Service Name
- Add a Key, and call it Parameters, and then navigate to it.
- Add a String Value, and call it Application. Enter the full path to your application’s executable file, and surround it with quotation marks (ie, “c:\Program Files\Cool Program\Cool Program.exe”)
- Add a String Value, and call it AppDirectory. Enter the full path to your application’s folder, and surround it with quotation marks (ie, “c:\Program Files\Cool Program”)
- Add a String Value, and call it AppParameters. Add any optional parameters your program requires.
- Close the registry editor
Now you must goto the Windows Services Manager to start the service.
- Goto Start > Control Panel > Administrative Tools > Services
- Locate your custom service, and start the service