I have the following code, but i'm so rusty on batch files i cant get the darn thing working.
Sometimes it reports correct, others it doesn't
Any help is great, the objective is to see if a task is running, if it is, good exit. If not it will call that program.
Sometimes it reports correct, others it doesn't
Code:
@Echo off
if exist tasklist /fi "IMAGENAME eq psa.exe" errorlevel 1
if errorlevel=1 (Goto :running) Else (goto :norun)
:running
echo Program is running
set errorlevel=0
Goto :eof
:norun
Echo Program is NOT running
set errorlevel=0
Goto :eof
Any help is great, the objective is to see if a task is running, if it is, good exit. If not it will call that program.