安装命令 MyApp.exe install
卸载命令 MyApp.exe uninstall
启动命令
net start MyApp
停止命令
net stop MyApp
WinSW下载地址https://github.com/winsw/winsw/releases
名字可以随意改变
xml和exe的名字要一致
<service>
<!-- 服务id,自行设置,与其他服务id不一致即可-->
<id>my_jar_service</id>
<!-- 服务名称,也就是显示在服务列表里的名称 -->
<name>my_jar_service</name>
<!-- 服务的描述 -->
<description>定时任务调度</description>
<!-- 需要启动的exe,我这里直接写了java,是因为配置了环境变量 -->
<executable>java</executable>
<!-- 要执行命令 -->
<arguments>-jar "my_jar_service.jar"</arguments>
<priority>Normal</priority>
<stoptimeout>15 sec</stoptimeout>
<stopparentprocessfirst>false</stopparentprocessfirst>
<startmode>Automatic</startmode>
<waithint>15 sec</waithint>
<sleeptime>1 sec</sleeptime>
<log mode="append"></log>
</service>