I need to know if a process is running or not

July 18, 2012 at 08:49:37
Specs: Windows 7 Pro, Intel(R) Core(TM) i3 / 3.20 GHz / 8 GB Ram
I need a batch file to continue whenever "My Own Program.exe" shuts down.

I have tried this:
@echo off
:loop
tasklist /FI "IMAGENAME eq MyOwnProgram.exe" 2>NUL | find /I /N "MyOwnProgram.exe">NUL
if "%ERRORLEVEL%"=="1" goto done
goto loop
:done

It works fine for single word processes, but not if it were 3 words (Like "My Own Program.exe").

Any help would be appreciated.


See More: I need to know if a process is running or not

Report •


#1
July 18, 2012 at 11:42:16
within the quotes, it worked fine for me? with the use of

tasklist /FI "IMAGENAME eq My Own Program"

:: mike


Report •

#2
July 18, 2012 at 12:23:53
It's bad practice to use spaces in the filenames of binaries.

Tony


Report •

Related Solutions


Ask Question