Created
March 3, 2017 14:26
-
-
Save jovib/49922cd1ecb29f0090146893d4beb150 to your computer and use it in GitHub Desktop.
Check if Windows service is running via batch file and start it, if it is not running.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for /F "tokens=3 delims=: " %%H in ('sc query "<service_name>" ^| findstr " ESTATE"') do ( | |
| if /I "%%H" NEQ "RUNNING" ( | |
| net start "<service_name>" | |
| ) else ( | |
| echo All stable. | |
| ) | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment