C:\test>perl -E"say 'notepad is ', grep( /notepad/, `tasklist`) ? '' : 'not ', 'running'" notepad is not running C:\test>start notepad.exe C:\test>perl -E"say 'notepad is ', grep( /notepad/, `tasklist`) ? '' : 'not ', 'running'" notepad is running