![图片[1]-windows 手动创建、删除服务-龙之小站资源屋](https://www.688918.com/wp-content/uploads/2024/08/d2b5ca33bd20240807161549-1024x578.png)
打开cmd或 PowerShell(需要管理员权限)。
1、创建服务
使用sc命令创建一个新的服务。
例如,运行以下命令来创建一个名为“MyService”的服务:
sc create MyService binPath= "C:\Path\To\MyProgram.exe" start= auto
其中,“binPath”指定应用程序的路径,“start”指定服务启动类型为自动。
2、删除服务
sc delete MyService
3、启动服务。
sc start MyService
4、查询服务状态
sc query MyService
如果服务正在运行,输出会包含“STATE : 4 RUNNING”字样。
5、停止服务,请运行以下命令:
sc stop MyService
6、更多命令
sc help # 所有命令
sc create help # create指令的详细服务
© 版权声明
THE END
暂无评论内容