Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to write a script (.bat file) to create a user defined service

Status
Not open for further replies.

jasonzhangx

Programmer
Mar 12, 2002
8
US
I have more than 50 machines (W2K) to install a user-defined service using:
INSTSRV.EXE
SVRANY.EXE

Is there a way to write a script to install the service automatically. Especially, I am interested in how to write the part to edit registry. The manual procedure is like:

Copy INSTSRV.EXE and SVRANY.EXE to %WINDIR%\system32
then goto start\run and type in this command

Instsrv xyz c:\winnt\system32\srvany.exe
This creates a service called xyz(you can name it anything)

Then goto regedit:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControllSet\Services\xyz
Create a key called Parameters
Open Parameters and create these three string values there:
AppDirectory "c:\xyz" (the path to your program dir)
Application "c:\xyz\xyz.exe" (the path to the app exe)
AppParameters "/???" (only if startup-parameters are needed)

 
IIRC, regedit /s <filename.reg> will silently write the regfile in registry.
Set the parameters on one machine, export the branch as a regfile and you should be ok.
The script will have to be run as admin to write in the HKLM hive.

 
Thanks for the suggestions. What is the syntax to export the registry to a regfile?
 
I found the GUI way to export the branch of the registry to a file.

Thanks for the help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top