今天发现一个Window系统服务增删改查神器:NSSM
官网地址:https://nssm.cc
Win10系统下这个:https://nssm.cc/ci/nssm-2.24-101-g897c7ad.zip
官方的帮助,英语的,可以大概看一下:
https://nssm.cc/usage
我拿它用来启kcptun
系统服务,安装脚本:
@echo off
for %%i in (1, 2, 3, 4) do (
nssm stop ss-kcp-%%i
nssm remove ss-kcp-%%i confirm || sc delete ss-kcp-%%i
nssm install ss-kcp-%%i confirm
nssm set ss-kcp-%%i Application D:\Tools\kcptun\client_windows_amd64.exe
nssm set ss-kcp-%%i DisplayName ss-kcp-%%i
nssm set ss-kcp-%%i AppDirectory D:\Tools\kcptun
nssm set ss-kcp-%%i Start SERVICE_DELAYED_START
nssm set ss-kcp-%%i AppParameters -c D:\Tools\kcptun\kcp%%i.json
nssm start ss-kcp-%%i
)