A tutorial to register any exe program as a windows system service

How to register any exe program as a windows system service? You need to start it manually every time you start it. Even if you add it as a startup item, the authority management under win8.1 is more strict, and the software cannot be started successfully when you start it. Let's see the implementation process

A certain gae agent software needs to be started manually every time it is booted. Even if it is added as a boot-up item, the authority management under win8.1 is more strict, and the software cannot be successfully started when booting (unattended booting), so search on the Internet. The way to register exe as a system service, find two posts on the forum, you can register the agent as a system service and start automatically when you start the system without having to manually start the program every time you restart the system.

Software name:
instsrv.exe srvany.exe package (the program can be installed as a windows service)

1. To realize this function, two small tools "instsrv.exe" and "srvany.exe" provided by Microsoft are used. First download these two programs and put them in the same directory, I put them directly on the D drive, and then enter the DOS command line and enter the following command to register the service:

d:\instsrv.exe tjserver d:\srvany.exe        //tjserver是服务名

This command is to register the srvany.exe program as a system service

2. Then enter the registry and find the newly registered service name tjserver under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services, create a new key in tjserver with the name "Parameters", click to select it and create a new string value in the window on the right The name is "Application", and its value is set to the path of the program you want to run as a service. For example, my path is "D:\tools\tjs.exe". It is especially important to note that the program path must be written the same as the previous example, that is, the middle is separated by a double slash, otherwise the service cannot be automatically started. If you need to make your registered service look more professional and understandable, you can continue to create a new string value named "Description", in which you can enter the service description you want to display.

3. Another thing to pay special attention to is that if the program you want to run as a service requires an interface after running, we can find the management tool in the control panel and open the service or directly run the "Services.msc" command to open Service, find the service you just created, right-click to open the properties, select the login tab, select the local system account as the login identity, and select Allow the service to interact with the desktop. Finally, click OK, so that you can see the interface after starting your service.

4. Delete the registered service

Stop the service first, then use the command "d:\instsrv.exe tjserver remove" to delete the service

There is also a program on the Internet that has the same interface operation as instsrv.exe. The name is "srvinstw.exe". You can complete the first step above with just a click of the mouse. The detailed usage method is not mentioned, it is very simple.

Guess you like

Origin blog.csdn.net/yunxiang1224/article/details/88686566