/WAIT
is not a guarantee. AutoDesk products are particularly bad about this. We have to monitor the process list for setup.exe
to discern whether the install is finished or not.
Something like this demonstrates the idea:
@ECHO OFF
SETLOCAL
SET TARGET=notepad.exe
start notepad
@ECHO Started!
:LOOP
ping -n 2 localhost >NUL
FOR /F %%T IN ('tasklist.exe /FI "IMAGENAME eq %TARGET%"') DO (
SET FOUND=0
IF "%%~T"=="%TARGET%" SET FOUND=1
)
IF %FOUND%==1 GOTO :LOOP
@ECHO Finished!
The ping is a (hackish) delay. The -n
argument effectively becomes how many seconds to delay.