判断服务是否存在,存在就直接启动,不存在则创建后启动,引号里的内容替换成自己的服务名即可

 

@echo off
sc query SService |findstr /i "STATE">nul
if not errorlevel 1 (goto exist) else goto notexist

:exist
sc start "SService"
pause
goto end

:notexist
sc create "SService" binpath= "%~dp0\SSFCJS.exe /S" type= own start= demand obj= localsystem Displayname= "SService"
sc start "SService"
pause
goto end

  

相关文章:

  • 2022-01-17
  • 2021-11-17
  • 2021-11-18
  • 2021-11-27
  • 2022-01-18
  • 2021-12-12
猜你喜欢
  • 2022-12-23
  • 2021-11-04
  • 2021-09-25
相关资源
相似解决方案