Why don't this work

April 17, 2009 at 13:22:01
Specs: Windows XP
I am trying to install a program while installing I want it to check to see if the setup.exe is running if so to wait 3 minutes and check again when finished up call to the next install. Etc... here is my code:

start /wait \\Ns01\CAD\AutoDesk2008\AutoCAD2008\AdminImage\Setup.exe \\Ns01\CAD\AutoDesk2008\AutoCAD2008\AdminImage\AutoCAD2008.ini

::@echo off
setlocal

:: Define operating environment
set app=setup.exe
set Wait=180

:loop
::Verify Instance Running
tasklist |find /i "%app%" >nul
if not %ERRORLEVEL% 1 echo %app% is running
IF %ERRORLEVEL% NEQ 0 goto :NEXT

echo Monitoring: %app%
echo waiting: %Wait% seconds

:wait
ping -n %Wait% localhost >nul
goto :loop

:NEXT
call "C:\Documents and Settings\tglidewell\Desktop\AutoCAD 2010 Install.bat"


Thanks,


See More: Why dont this work

Report •


#1
April 17, 2009 at 14:44:24
Replace

if not %ERRORLEVEL% 1 echo %app% is running
IF %ERRORLEVEL% NEQ 0 goto :NEXT


with

if ErrorLevel 1 goto :NEXT
echo. %app% is running

If ErrorLevel is a special IF statement where ErrorLevel is a keyword not a variable. There is the %ErrorLevel% variable too however.


Report •
Related Solutions


Ask Question