admin avatar

Super simple, method for registering program or software as system service under windows system

🕐 by admin

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

1
2
3
4
5
6
7
<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

1
2
<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

1
2
3

.\winsw.exe install

If successful, the following message will be displayed

1
2
3
4
5

#.\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

1
2
3

.\winsw.exe uninstall

💘 相关文章

写一条评论