一、cmd命令行---进行Windows服务操作
1、安装服务
sc create 服务名 binPath= "C:\Users\Administrator\Desktop\win32srvDemo\win32srvdemo\Debug\win32srvDemo.exe"
注:服务名:指创建的Windows服务名
binPath:指Windows服务程序的路径
2、配置服务
sc config 服务名 start=AUTO
注:start=AUTO (自动)
start=DEMAND (手动)
start=DISABLED (禁用)
3、开启服务
net start 服务名
4、关闭服务
net stop 服务名
5、删除服务
sc delete 服务名
二、bat批处理---进行Windows服务操作
(新建一个txt文件,把后缀改成.bat文件)
1、创建、配置、开启服务
@echo.服务启动...... @echo off @sc create 服务名 binPath= "C:\Users\Administrator\Desktop\win32srvdemo\win32srvdemo\Debug\win32srvdemo.exe" @net start 服务名 @sc config 服务名 start= AUTO @echo off @echo.启动完毕! @pause
2、关闭服务
@echo.服务关闭 @echo off @net stop 服务名 @echo off @echo.关闭结束! @pause
3、删除服务(删除前要关闭服务)
@echo.服务删除 @echo off @sc delete 服务名 @echo off @echo.删除结束! @pause
二、SC命令
网友博客:http://blog.csdn.net/ddjj_1980/article/details/7493045
转载:http://blog.csdn.net/moruna/article/details/9190733
原标题:SC命令
关键词: