According to this http://blogs.msdn.com/b/heaths/archive/2005/11/15/493236.aspx?Redirected=true I should get an updated %ERRORLEVEL% after msiexec is executed from the script using the Start /WAIT command. It isn't working for me. Can someone help me understand why and how I can fix it?
Here's my code.
Code: Select all
@echo off
Set RegQry=HKLM\Hardware\Description\System\CentralProcessor\0
REG.exe Query %RegQry% > checkOS.txt
Find /i "x86" < CheckOS.txt > StringCheck.txt
If %ERRORLEVEL% == 0 (
Set OSVersion=32bit
) ELSE (
Set OSVersion=64bit
)
del checkOS.txt
del StringCheck.txt
:INSTALLTIGHTVNC
ECHO installing and setting up VNC on computer.
IF %OSVersion% == 32bit (
START /WAIT "TIGHTVNC" msiexec /qb /norestart /i tightvnc-2.7.10-setup-32bit.msi ADDLOCAL="Server,Viewer" SET_USEVNCAUTHENTICATION=1 VALUE_OF_USEVNCAUTHENTICATION=1 SET_PASSWORD=1 VALUE_OF_PASSWORD=xxx SET_CONTROLPASSWORD=5
IF %ERRORLEVEL% NEQ 0 (
START "Download Installer" "http://www.tightvnc.com/download/2.7.10/tightvnc-2.7.10-setup-32bit.msi"
echo x=MSGBOX ("Either you have the wrong tightvnc installer or it's not on your thumbdrive. This BAT file is opening up a browser to the correct installer. Please save it to your thumbdrive in the same directory as your batch file.",0,"TightVNC Install is Completed!"^) > %temp%\TEMPmessage.vbs
call %temp%\TEMPmessage.vbs
del %temp%\TEMPmessage.vbs /f /q
SET /P READY=PRESS ENTER WHEN READY TO RETRY INSTALLING TIGHTVNC
GOTO :INSTALLTIGHTVNC
)
) ELSE (
START /WAIT "TIGHTVNC" msiexec /qb /norestart /i tightvnc-2.7.10-setup-64bit.msi ADDLOCAL="Server,Viewer" SET_USEVNCAUTHENTICATION=1 VALUE_OF_USEVNCAUTHENTICATION=1 SET_PASSWORD=1 VALUE_OF_PASSWORD=xxx SET_CONTROLPASSWORD=5
IF %ERRORLEVEL% NEQ 0 (
START "Download Installer" "http://www.tightvnc.com/download/2.7.10/tightvnc-2.7.10-setup-64bit.msi"
echo x=MSGBOX ("Either you have the wrong tightvnc installer or it's not on your thumbdrive. This BAT file is opening up a browser to the correct installer. Please save it to your thumbdrive in the same directory as your batch file.",0,"TightVNC Install is Completed!"^) > %temp%\TEMPmessage.vbs
call %temp%\TEMPmessage.vbs
del %temp%\TEMPmessage.vbs /f /q
SET /P READY=PRESS ENTER WHEN READY TO RETRY INSTALLING TIGHTVNC
GOTO :INSTALLTIGHTVNC
)
)
echo x=MSGBOX ("Installation and Configuration of TightVNC is done on this %OSVersion% version of Windows.",0,"TightVNC Install is Completed!"^) > %temp%\TEMPmessage.vbs
call %temp%\TEMPmessage.vbs
del %temp%\TEMPmessage.vbs /f /q
EXIT