Send to a Friend

XOIIO's avatar

How can I add an ELSE to this batch script?

Asked by XOIIO (18328points) March 9th, 2012

Basically I want to add “ELSE” to this batch command, where if the program is running it says it is, but if it isn’t then it says it sin’t, like so:

Original

tasklist /nh /fi “imagename eq explorer.exe” | find /i “explorer.exe” >nul && (
echo Explorer.exe is running)

Desired

tasklist /nh /fi “imagename eq explorer.exe” | find /i “explorer.exe” >nul && (
echo Explorer.exe is running) ELSE (echo Explorer.exe is not running)

However, it says ELSE was not expected at this time. How can I tweak this to work?

Using Fluther

or

Using Email

Separate multiple emails with commas.
We’ll only use these emails for this message.