xp conditional command

February 19, 2009 at 12:38:37
Specs: Windows XP
Hi
I'm looking for Conditional xp command
First check a.exe if not run then run it
---------
similar this
If a.exe is not run
Call a.exe
---------
Thanks in advance

See More: xp conditional command

Report •


#1
February 19, 2009 at 13:49:03
You might be able to do this using Tasklist, I got frustrated trying to use the command as it always encountered an illegal instruction so I've gone to PV.EXE which is available at http://www.softpedia.com/progDownlo...

Sample code to invoke and start Notepad.exe if not running is:

:: Code begins...
@ECHO off
cls

pv.exe > %temp%\result.txt

FIND "notepad.exe" %temp%\result.txt
IF ERRORLEVEL 1 START notepad.exe

exit
:: Code ends....

OR a simpler method without using a disk file:

:: Code begins....
@ECHO off
cls

pv.exe | FIND "notepad.exe" > nul
IF ERRORLEVEL 1 (
   START notepad.exe
   ) else (
   echo Notepad.exe is already running
   echo.
   echo Press any key to continue...
   pause > nul
)

exit
:: Code ends....


Report •

#2
March 5, 2009 at 12:38:33
Thanks Garibaldi

Report •

Related Solutions


Ask Question