Rem Find if the service is running
sc query | findstr /C:"Name of Service"
Rem what is the error code 0 or 1
echo %errorlevel%
Rem If error level 0 goto Running
if %errorlevel%==0 GOTO Running
Rem If error level 1 Goto NotRunning
if %errorlevel%==1 GOTO NotRunning
REM jump to End if Errorlevel is not 0 nor 1 = A PROBLEM ...
GOTO End
:Running
echo Service is running
GOTO End
:NotRunning
Rem This command changes the service to Manual
sc config "Name of Service" start= demand
Rem This command starts the service
sc start "Name of Service"
echo Not Running
echo Starting service
:End
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment