How to use the :IsFileOpen, IsRegKey, IsRegValue, IsServiceR
Posted: 10 Feb 2009 08:17
I'm looking for examples on how to use or test the results from the IsFileOpen, IsRegKey, IsRegValue, or IsServiceRunning functions.
A Forum all about DOS Batch
https://www.dostips.com/forum/
Code: Select all
@Echo Off
call:IsServiceRunning "DHCP"&&echo.DHCP service is Running
call:IsServiceRunning "DHCP"||echo.DHCP service is not Running
Goto:Eof
: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 http://www.dostips.com
SETLOCAL ENABLEDELAYEDEXPANSION
sc query "%~1"|findstr "STATE.*:.*4.*RUNNING">NUL
EXIT /b