-
下载 instsrv.exe 和 srvany.exe
下载的地址 https://pan.baidu.com/s/1P08Lz_XYIfYHzB1ltDMagA
-
打开cmd cd 到 解压目录
cd C:\srvany
-
执行命令 instsrv.exe 你的服务名称 srvany.exe文件路径
instsrv.exe TestServer C:\program\srvany\srvany.exe
把exe程序设置成Windows服务运行 -
打开注册表
路径:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TestServer 找到刚注册的服务名称
- 新建项:Parameters
- 在Parameters下新建字符串值:
- 名称为: Application 值: exe 所在的全路径 包含exe名称为: Application 值: exe 所在的全路径 包含exe
- 在Parameters下新建字符串值: 名称为: AppDirectory 值: exe 所在的路径
把exe程序设置成Windows服务运行 - 打开服务,找到刚才所创建的服务名称,配置属性,点击启动
-
删除服务,先将服务停止
cd 到instsrv.exe 所在目录 然后执行
instsrv.exe TestServer remove
把exe程序设置成Windows服务运行