In order to proceed, you firstly need two programs: instsrv.exe and srvany.exe. These programs are produced by Microsoft and are parts of Windows Resource Kit Tools.
To call a program as a new Windows service, follow this procedure:
- Create a new directory, let's say winsrv, on drive c
- Store both instsrv.exe and srvany.exe on that directory
- Open a DOS window
- Type: cd /d c:\winsrv
- Type: instsrv "service name" c:\winsrv\srvany.exe
- Exit from DOS window
- Open regedit
- Navigate to this key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\service name
- Add a new key: Parameters
- Under the key Parameters, add these three string values: Application AppDirectory AppParameters
- Set the AppDirectory value to the directory where the program is stored into
- Set the Application value to the program name
- Set the AppParameters value to the command line parameters passed in program invocation
In order to run the specified program, you may provide additional authentication information. This can be accomplished specifying log on parameters in the service properties.
To remove the new service, just follow this procedure:
- Open a DOS window
- Type cd /d c:\winsrv
- Type instsrv "service name" remove
1 comment:
How can I get data from database to put into a dataset in a window service?
Post a Comment