Thursday, April 2, 2015

How to check if a service is not running and start it via batch

net start | find SERVICENAME > nul 2>&1
if not .%errorlevel%.==.0. goto startservice
goto skip

:startservice
net start SERVICENAME
echo service restarts @ %date% %time% >> C:\checklog.txt


No comments:

Post a Comment