Skip to content

Instantly share code, notes, and snippets.

@glucero
Last active August 29, 2015 14:05
Show Gist options
  • Save glucero/45b7da093a861536ca56 to your computer and use it in GitHub Desktop.
Save glucero/45b7da093a861536ca56 to your computer and use it in GitHub Desktop.
monitor process status with command output template
@ECHO OFF
SETLOCAL EnableExtensions
SET PROCESS=%~nx1
SET NAME=%~n1
FOR /F %%x IN ('tasklist /NH /FI "IMAGENAME eq %PROCESS%"') DO IF %%x == %PROCESS% GOTO FOUND
ECHO OS^|Windows^|Process^|%NAME%^|Status 0 2 %NAME% (%PROCESS%) is not running.
GOTO EOF
:FOUND
ECHO OS^|Windows^|Process^|%NAME%^|Status 1 0 %NAME% (%PROCESS%) is running.
:EOF
@glucero
Copy link
Author

glucero commented Aug 26, 2014

process_status.bat MyProcess.exe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment