Super simple, method for registering program or software as system service under windows system
Super simple, method for registering program or software as system service under windows system
This demand is mainly based on the fact that software or programs can run in the background under the windows system
Or start it up to achieve unconscious operation. . . Very convenient and easy to use
Here mainly introduces the open source winsw tool, winsw download address is as follows
https://github.com/kohsuke/winsw/releases
The download version here is the version of .net4. . . As shown below

Renamed to a simple and easy to remember name, here renamed to winsw.exe
Copy winsw.exe to the program or software directory, here t r o j a n as an example
Create a new winsw.xml file, this must have the same name as the above winsw.exe,
For example, if you renamed WinSW.NET4.exe then the file name must be WinSW.NET4.xml
winsw.xml file content is as follows, fill in according to your needs
<service>
<id> myT * r o * j a n </id>
<name> T * r o * j * a n </name>
<description> none description </description>
<executable> t * r * o * j a n </executable>
<logmode>rotate</logmode>
</service>
For some special reasons, the above code adds spaces and matches, please delete it yourself
<executable> This is the name of the program / software that needs to be registered as a system service. No exe suffix is required.
Launch Windows PowerShell or cmd command window with administrator privileges,
Enter the program or software root directory
Execute the following command to register as a system service
.\winsw.exe install
If successful, the following message will be displayed
#.\winsw.exe install
2020-03-04 19: 40: 24,648 INFO-Installing the service with id 'myT * r * o
j * a * n '
See if the system service is successfully installed

If you want to uninstall the service, execute the following command
.\winsw.exe uninstall