The bat file to register as a system service

The first chapter registration system preparation service

1.1 Preparation before the service registration system

1.1.1 involving third-party software

 Bat_To_Exe_Converter.exe (* .bat files into the executable * .exe file)

 instsrv.exe (Microsoft's own server software registration system)

 srvany.exe (Microsoft's own server software registration system)

 SRVINSTW.EXE (service installation and uninstall the software, this document is mainly borrowed it to uninstall the service)

Chapter II Registration System service process

This document registration system server general idea is as follows:

First batch file * .bat files into an executable file * .exe, then the executable file * .exe registered as a system service.

2.1 * .bat files into the * .exe file

Borrowing third-party software Bat_To_Exe_Converter.exe, * .bat files into the * .exe file, as follows:

First import of * .bat file transfer needs, as shown below: installService.bat, then click "Compile" button compiled * .exe file, generate * .exe file with the default file name and path * .bat consistent, as generated file: D: \ installService \ installService.exe

 

 

2.2 * .exe file registration system services

2.2.1 New Service

The instsry.exe srvany.exe and copied to d: \ installService folder,

Instsrv and srvany to use a new name: installService service.

Command: instsrv service name d: \ installService \ srvany.exe

FIG follows:

 

After the new service, you can enter the registry, view the service, as follows:

"Start" - "Run" - "regedit", find

[HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ installService], which installService for the newly created service name, as shown:

 

2.2.2 Registration Service

The first step: enter the name of the new service, create a new item, value: Parameters

 

Step two: move on to the "Parameters", a new "string value (s)", name: AppDirectory, AppDirectory modify the parameter value * .exe executable file directory path. Such as: D: \ installService, specifically shown:

 

Third step: In the item "Parameters", a new "string value (s)", name: Application, Application to modify the parameter value * .exe file path to an executable file. Such as: D: \ installService \ installService.exe, specifically shown:

 

Step 4: Check two "character value (S)" is correct, as shown:

 

Step 5: Check whether the service is successfully registered.

      Click on "My Computer" - "Management" - "Computer Management" - "Services and Applications" - "service" to see if there is a service called:. InstallService specific figure:

After the service is installed successfully, the default "auto start", but first needs to be started manually.

Guess you like

Origin www.cnblogs.com/guohu/p/11105446.html