Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ::Change the name of notepad.exe to the process .exe that you're trying to track
- ::Process names are CASE SENSITIVE, so notepad.exe works but Notepad.exe does NOT
- ::Do not change IMAGENAME
- ::You can Copy and Paste this into an empty batch file and change the name of
- ::notepad.exe to the process you'd like to track
- ::Also, some large programs take a while to no longer show as not running, so
- ::give this batch a few seconds timer to avoid a false result!!
- @echo off
- SETLOCAL EnableExtensions
- set EXE=notepad.exe
- FOR /F %%x IN ('tasklist /NH /FI "IMAGENAME eq %EXE%"') DO IF %%x == %EXE% goto ProcessFound
- goto ProcessNotFound
- :ProcessFound
- echo %EXE% is running
- goto END
- :ProcessNotFound
- echo %EXE% is not running
- goto END
- :END
- echo Finished!
Advertisement
Add Comment
Please, Sign In to add comment