创建服务,启动服务,停止服务,删除服务的批处理的编写

1、创建服务,命名为Create.bat

@echo.Service create...... 
set a="%~dp0programName.exe"
@echo off 
@sc create ***(serverName)binPath= %a% 
@sc config
***(serverName) start= AUTO
@echo off @echo.create end! @pause

2、启动服务,命名为Start.bat

@echo.Service starting......  
@echo off  
@net start ***(serverName)
@echo off @echo.start end! @pause

3、停止服务,命名为Stop.bat

@echo.Service Close 
@echo off 
@net stop ***(serverName)
@echo off @echo.close end! @pause

4、删除服务,命名为Delete.bat

@echo.Services delete......  
@echo off  
@sc delete ***(serverName
@echo off @echo.delete end! @pause

 以上是四个批处理文件,启动服务的步骤为create,start。

posted @ 2017-12-27 15:11  木木ing  阅读(3429)  评论(0编辑  收藏  举报