Solution: Register the system (bat file) as Windows service


1. Download instsrv.exe and srvany.exe

Download: github.com/zaishiba/so…

After downloading, copy instsrv.exe and srvany.exe to C:\Windows\System32. Copy a copy to C:\Windows\SysWOW64 for 64-bit operating systems.

2. Run the DOS command

Open cmd.exe and enter the following command

instsrv ServiceName C:\Windows\System32\srvany.exe
Copy the code

ServiceName: indicates the name defined by the SRD system


3. Operate the registry

Open the registry and follow the path HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ServiceName to find the custom ServiceName.

The ServiceName in the path is the ServiceName you defined when you installed the service.

If there is no Parameters project under your custom service name, right click on the new item named Parameters for the service name project, then navigate to the Parameters item and create the following string values.

  • The name Application value is the address of the BAT file you want to run as a service (for example:C:\server\prj-siemens-bj\bin\prj-siemens-bj.bat).
  • The name AppDirectory value is the path to the BAT file you want to run as a service (for example:C:\server\prj-siemens-bj\bin).
  • The name AppParameters value is the parameter you need to start the BAT file that you want to run as a service.

4. Start and delete the service

Enter services. MSC in cmd.exe to open the service, find the custom service name, and click Start

Run the following command to delete the service

Before deleting the service, you need to close the service and enter the code in the DOS window.

Delete using instsrv

instsrv delete ServiceName
Copy the code

Run the sc command to delete it

sc delete ServiceName
Copy the code

ServiceName: indicates the user-defined ServiceName

5. The SRD system is still running after the service is deleted

The SRD system is still running after the service is deleted and the SRD system resources loaded locally are deleted

Solution: Kill the Java process

# # to view all ports netstat - a # # to check the port 7100 of SRD system netstat ano | findstr searches "7100" # # to kill the process of using ports, Taskkill /f /t /im 6564Copy the code

5, self-test

I have copied instsrv.exe and srvany.exe to C:\Windows\System32 and 64-bit OPERATING systems C:\Windows\SysWOW64.

Run the DOS command

View services and manipulate the registry

Enter regedit in cmd.exe to open the registry and follow the path described above to find SeerSrdServer.

Follow step 3 to create a new entry and add the corresponding string value to the registry.

Start the service

Check whether the SRD system is started successfully. Log out and start the SRD system again.

\