calvinturbo

Batch script

Jun 24th, 2017
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. ::Change the name of notepad.exe to the process .exe that you're trying to track
  2. ::Process names are CASE SENSITIVE, so notepad.exe works but Notepad.exe does NOT
  3. ::Do not change IMAGENAME
  4. ::You can Copy and Paste this into an empty batch file and change the name of
  5. ::notepad.exe to the process you'd like to track
  6. ::Also, some large programs take a while to no longer show as not running, so
  7. ::give this batch a few seconds timer to avoid a false result!!
  8.  
  9. @echo off
  10. SETLOCAL EnableExtensions
  11.  
  12. set EXE=notepad.exe
  13.  
  14. FOR /F %%x IN ('tasklist /NH /FI "IMAGENAME eq %EXE%"') DO IF %%x == %EXE% goto ProcessFound
  15.  
  16. goto ProcessNotFound
  17.  
  18. :ProcessFound
  19.  
  20. echo %EXE% is running
  21. goto END
  22. :ProcessNotFound
  23. echo %EXE% is not running
  24. goto END
  25. :END
  26. echo Finished!
Advertisement
Add Comment
Please, Sign In to add comment