:IsServiceRunning

returns success if service is running, otherwise failure

Description: call:IsServiceRunning service
Script:
1.
2.
3.
4.
5.
6.
7.
:IsServiceRunning service -- returns success if service is running, otherwise failure
::                        -- service  [in]  - name of the service to check
:$created 20060101 :$changed 20080219 :$categories ServiceControl
:$source https://www.dostips.com
SETLOCAL ENABLEDELAYEDEXPANSION
sc query "%~1"|findstr "STATE.*:.*4.*RUNNING">NUL
EXIT /b