jar注册为win服务


方法一:使用WinSW工具

工具地址:https://link.jianshu.com/?t=https://github.com/kohsuke/winsw/releases

参考:https://blog.csdn.net/wgd930701/article/details/123640481

方法二:借助命令添加服务

1 创建bat文件

D:\tool\ddns\myddns.bat:
1 @echo off
2 D:
3 cd D:\tool\ddns
4 ping -n 10 127.0.0.1>nul
5 java -jar AliDDNS.jar

2 添加到服务

sc create myddns binPath=D:\tool\ddns\myddns.bat start=auto
Win