把任意exe程序或脚本封装成windows系统服务,重复造的轮子,其他推荐使用winsw
- 轻量级,仅仅一个主要文件
- 配置简单,采用非xml的properties(ini)配置
- 支持界面配置
复制WindowsServiceWarpper.exe到任意位置,在同目录下建立warpservice.properties 文件,配置参考WindowsServiceWarpperConfig/warpservice.properties
例如创建Nginx服务,配置
ServiceName = nginxSvr
ServiceDisplayName = Nginx Service
#运行程序
Exe = E:\nginx-1.14.2\nginx.exe
#停止参数
StopArgs = -s stop
创建服务
sc create nginxSvr binPath= "E:\nginx-1.14.2\WindowsServiceWarpper.exe" DisplayName="Nginx Service"
删除服务
sc delete nginxSvr
提供WindowsServiceCreater.exe进行配置的编辑、服务的安装
使用Visual Studio Community打开