Win10 registers .bat or .exe as a system service (NSSM)

1. Download NSSM:

Link: https://pan.baidu.com/s/1pkmSW8FEUS2w2Zie-BrKjw Extraction code: t5u3

Or download from the official website: http://www.nssm.cc/download

2. Open win32 or win64 after decompression

3. Directly enter cmd in the address bar to open the black box and it will automatically enter the directory or use win+R to enter cmd and open the black box, and use the cd command to enter the directory

4. Enter the nssm install service name

5. Select the bat file or exe file in Path and click Install service to complete

6. Go to the system service to view: right-click the computer, select management (open the computer management panel), find the service in the service and application, and find the service just installed on the right to set the configuration such as startup.

7. NSSM common commands

nssm install servername //create servername service
nssm start servername //start service
nssm stop servername //pause service
nssm restart servername //restart service
nssm remove servername //delete created servername service

 8. Matters needing attention

After the system service is installed, do not move or delete the nssm file, because when you view the service, you can see that the executable file is nssm.exe. If you delete it, the service will not start. After deleting the service, you need to restart the computer to completely delete it.

Guess you like

Origin blog.csdn.net/JohnGene/article/details/124293255