Just replace yourservice on line 5 and 16 with the name of the service you want to stop or start.
@ECHO OFF
REM Checking Service state
REM replace yourservice below with the name of the service
net start yourservice 2>nul
if errorlevel 2 goto AlreadyRunning
if errorlevel 1 goto Error
REM Service started
GOTO ContinueWithBatch
:AlreadyRunning
REM Service is already running
REM replace yourservice below with the name of the service
net stop yourservice
GOTO ContinueWithBatch
:Error
REM Service failed to start
GOTO ContinueWithBatch
:ContinueWithBatch
No comments:
Post a Comment