You are not logged in.
I am wanting to write a script that adjusts based on the services running. I want to check for a file running in my batch file and than act accordingly.
tasklist /fi "imagename eq notepad.exe"
Is there a way to read the output and use that to change what happens next?
Using Errorlevel always returns a value of 0.
Example...
tasklist /fi "imagename eq notepad.exe"
if notepad is running - echo I am running!
if notepad isnt running - echo I am not running!
Offline
use a find filter to locate notepad.exe and then find.exe will set the errorlevel.
Offline
tasklist | find "notepad.exe"
Great idea! Thanks.
Offline
Hi, smurff289.
it seems like you understand the concept of errorlevel.
can you explain to me, what is errorlevel ?
what is returning value to 0 and 1 ?
i don't get that part.
thank you.
Detour in life always surprise people.
Offline