Question

I'm trying to install the Autodesk2013 Suite using this batch

@echo off
title Installing Autodesk Suite then logging off....

NET USE \\directory /user:********\****** ****** /persistent:YES

ECHO "Installing Autodesk Suite. This workstation will log off automatically when installation is complete."

START /WAIT /B "" "....\Setup.exe" /qb /I \AutoDesk2013.ini /language en-us

ECHO "Finished"

TIMEOUT /T 10
SHUTDOWN /l /f
EXIT

It initialises the install perfectly fine but it isn't waiting until it's finished, instantly moves on. I thought /WAIT was meant to stop that?

Thanks in advance.

Edit: Final working batch:

@echo off
title Installing Autodesk Suite then logging off....

NET USE \\sccm\d$ /user:******\***** ******* /persistent:YES

ECHO "Installing Autodesk Suite. This workstation will log off automatically when installation is complete."

START /B "" "\AdminImage\Setup.exe" /qb /I \AdminImage\AutoDesk2013.ini /language en-us
TIMEOUT /T 10
SETLOCAL

SET TARGET=Setup.exe
@ECHO Started!

:LOOP
ping -5 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"

TIMEOUT /T 10
SHUTDOWN /l /f
EXIT
Was it helpful?

Solution

/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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top