WMCI - how to get the ERRORLEVEL

Posted by murxx on Stack Overflow See other posts from Stack Overflow or by murxx
Published on 2010-05-20T14:08:12Z Indexed on 2010/05/20 14:10 UTC
Read the original article Hit count: 160

Filed under:
|

Hi,

I want to use the "wmic" command for finding out if a specific java process is still up and running.

E.g.> wmic process where "commandLine like '%ACTMonitor%' and executablePath like '%PATH1%' and name like '%java%'"

The problem now is that the errorlevel of this command is always 0, no matter if there is a process listed or not. How can I manage to get an errorlevel != 0 in case the process is not up anymore? Or can one of you tell me another suggestion on how to be able to continue in a .bat script with this information...

Thanks in advance!

© Stack Overflow or respective owner

Related posts about dos

Related posts about .bat