cmd将exe程序注册成服务

1.注册服务
sc create Nginx binpath= D:Nginx ginx ginx.exe type= own start= auto displayname= nginxApi

2.启动服务
net start nginxApi

3.停止服务
net stop nginxApi

4.删除服务
sc delete "nginxApi"

原文地址:https://www.cnblogs.com/Gxiaopan/p/14658129.html