How can I check if an application is running from a batch (well cmd) file?
I need to not launch another instance if a program is already running. (I can\'t change th
I used the script provided by Matt (2008-10-02). The only thing I had trouble with was that it wouldn't delete the search.log
file. I expect because I had to cd
to another location to start my program. I cd
'd back to where the BAT file and search.log
are, but it still wouldn't delete. So I resolved that by deleting the search.log
file first instead of last.
del search.log
tasklist /FI "IMAGENAME eq myprog.exe" /FO CSV > search.log
FOR /F %%A IN (search.log) DO IF %%-zA EQU 0 GOTO end
cd "C:\Program Files\MyLoc\bin"
myprog.exe myuser mypwd
:end