golang打包成exe 在windows作为服务开机自启

golang打包成exe 在windows作为服务开机自启,第1张

下载工具

需要的工具有如下两个
instsrv.exesrvany.exe
链接:https://pan.baidu.com/s/1N1WyCCL7-uleTIpYv7llLw
提取码:ranw

下载后将文件解压出来, 放到如下路径中
C:\Windows\SysWOW64

添加服务项

打开cmd命令窗口, 进入到C:\Windows\SysWOW64

运行如下命令生成一个名称为MyService的服务

C:\Windows\SysWOW64>instsrv MyService C:\WINDOWS\SysWOW64\srvany.exe

The service was successfuly added!

Make sure that you go into the Control Panel and use
the Services applet to change the Account Name and
Password that this newly installed service will use
for its Security Context.

看到提示The service was successfuly added!

欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/langs/996380.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-21
下一篇 2022-05-21

发表评论

登录后才能评论

评论列表(0条)

保存