我正在尝试使用此批次安装Autodesk2013套件
@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
它初始化安装完全正常但它不会等到它完成,立即继续前进。我认为/ WAIT是为了阻止它?
提前致谢。
编辑:最终工作批次:
@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
答案 0 :(得分:1)
/WAIT
不是保证。 AutoDesk产品对此尤其不利。我们必须监视setup.exe
的进程列表,以辨别安装是否已完成。
这样的事情表明了这个想法:
@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!
ping是一种(hackish)延迟。 -n
参数实际上变成了延迟的秒数。