Skip to content

Instantly share code, notes, and snippets.

@Andorbal
Created March 5, 2012 15:21
Show Gist options
  • Save Andorbal/1978720 to your computer and use it in GitHub Desktop.
Save Andorbal/1978720 to your computer and use it in GitHub Desktop.
Restart a windows service
@ECHO OFF
sc query <servicename> | find "STATE" | find "RUNNING" > nul 2>&1
if .%errorlevel%.==.0. goto skip
sc start <servicename> > nul 2>&1
echo service restarts @ %date% %time% >> checklog.txt
:skip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment