原理:使用winsw将shell命令包成服务并设置开机自启动
winsw github地址:https://github.com/winsw/winsw/releases/tag/v2.11.0
下载后将winsw.exe(WinSW-x64.exe 重命名后的名称为winsw.exe)放在和frp同级目录
新建xml文件命名为winsw.xml,进行配置,如下:
<service>
<id>frpcid>
<name>frpcname>
<description>frpc服务description>
<executable>frpcexecutable>
<arguments>-c frpc.iniarguments>
<logmode>resetlogmode>
service>
文件结构如下图所示:


运行命令:
# 安装服务
winsw.exe install
# 卸载服务
winsw.exe uninstall