Check whether process is running in batch

article #166, updated 5295 days ago

This works in recent Windows versions, but not in XP Home:

tasklist /FI "IMAGENAME eq myapp.exe" 2 > NUL | find /I /N "myapp.exe" > NUL
if "%ERRORLEVEL%"=="0" echo Program is running

This was copied shamelessly from here:

http://stackoverflow.com/questions/162291/how-to-check-if-a-process-is-running-via-a-batch-script

Categories: