失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > 服务封装软件 winsw

服务封装软件 winsw

时间:2021-10-16 06:02:01

相关推荐

服务封装软件 winsw

winsw(Windows Service Wrapper)是一个开源项目,它可以让我们快速把一个可执行的程序注册为Windows的系统服务。

下载

下载页面如下: (下载地址)

需要下载可执行程序(4.exe)以及配置文件(sample-minimal.xml)。

可执行程序有2.exe以及4.exe,根据当前系统的.NET版本进行选择。如果是Win10建议使用4.exe

配置文件有sample-minimal.xml以及sample-allOptions.xmlsample-allOptions.xml包括所有配置项,sample-minimal.xml为可使用的最小配置,使用这个即可满足条件。

sample-minimal.xml内容如下:

<configuration><!-- ID of the service. It should be unique accross the Windows system--><id>myapp</id><!-- Display name of the service --><name>MyApp Service (powered by WinSW)</name><!-- Service description --><description>This service is a service cratead from a minimal configuration</description><!-- Path to the executable, which should be started --><executable>%BASE%\myExecutable.exe</executable></configuration>

配置

以安装X:\Test.exe为例,将WinSW.NE4.EXEsample-minimal.xml放在文件夹(X:\winsw\)内,将其分别重命名为Test.exeTest.xml(必须同名,否则会失败),将Test.xml修改为:

<configuration><!-- ID of the service. It should be unique accross the Windows system--><id>100001</id><!-- Display name of the service --><name>Test</name><!-- Service description --><description>Service of Test</description><!-- Path to the executable, which should be started --><executable>X:\Test.exe</executable></configuration>

安装

以管理员权限运行cmd,进入目录X:\winsw\,运行命令Test.exe install即可完成安装。

其他常用命令如下:

Test.exe uninstallTest.exe startTest.exe restartTest.exe stop

其他

如果需要设置多个程序,需要设置多个配置文件,winsw不支持一个配置文件设置多个程序。

参考

用winsw让任何Windows程序都能运行为服务

windows中使用winsw进行服务管理开启启动服务

如果觉得《服务封装软件 winsw》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。