0

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
Crimsonfox
  • 422
  • 2
  • 9
  • 20
  • 1
    Some installers (`setup.exe`) call `msiexec` to do the work and exit, leaving the work to the system. Are you sure this is not your case? – MC ND Dec 04 '13 at 12:18
  • Is there a way of finding this out without specifically looking up whether the Autodesk Setup does this? – Crimsonfox Dec 04 '13 at 12:22
  • Start setup and in task manager look if it keeps open or it closes. – MC ND Dec 04 '13 at 12:41
  • It's so quick I don't think I can tell. I end up with a TrustedInstall.exe and 2 x Setup.exe in TM. – Crimsonfox Dec 04 '13 at 12:46

1 Answers1

1

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

mojo
  • 4,050
  • 17
  • 24