Hi all!

I am new here! Just looking for some help. I have been packaging software for years and am actually doing my first hardware driver. I am packaging the Intekl HD Graphics Driver for Windows XP (32bit) for Lenova Thinkpad T410S laptops.

This is a good chunk of my script.
I am not real familiar with using errorlevels so I took that from another script but am not certain I am using it correctly. The bigger problem is that the script fails at the If....Else statement. It will not go to the :INSTALL_Driver section of the script unless I skip the If....Else statement. I have also tried many other more simplistic ways of accomplishing this and still no go.
I also tried:
if [%machinecode%]==[410s] goto Install_driver
goto exit
This failed as well. [:(]



Title T410S Driver Update Installation
set logfile=c:\logs\t410s_Driver_Update.log
Set DEFAULTERRCODE=1627
echo [%date%] [%time%] Starting ATI Driver Update Phase 1>> %logfile%
echo [%date%] [%time%] Determining Machine Code>>%logfile%
for /f "tokens=3 skip=2" %%f in ('reg query "HKLM\software\vanguard\initial build" /v machinecode') do set machinecode=%%f
echo [%date%] [%time%] Machine Code is [%machinecode%]>>%logfile%
if [%machinecode%]==[410s] (
goto INSTALL_Driver
) else (
echo [%date%] [%time%] This Model is not a t410s>> %logfile%
echo Failed: INTEL Video Driver did not install > c:\elevate\statusmif\smsjob.status
)
Exit
:INSTALL_Driver
echo [0000] [%date%] [%time%] Starting the INTEL Video Applet Installation >>%logfile%
rem pushd Intel
setup.exe -s
echo [0000] [%date%] [%time%] Finished INTEL Video Driver Installation [%errorlevel%]>>%logfile%
echo Success: INTEL Video Driver is installed > c:\elevate\statusmif\smsjob.status
rem popd
IF [%ERRORLEVEL%] NEQ [0] GOTO SCRIPT_ERROR
Exit
:SCRIPT_ERROR
echo [0020] [%date%] [%time%] Return Code from Install is -%errorlevel%- >> %logfile%
Exit
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
IF [%ERRORLEVEL%] NEQ [0] GOTO SCRIPT_ERROR
Exit
:SCRIPT_ERROR
echo [0020] [%date%] [%time%] Return Code from Install is -%errorlevel%- >> %logfile%
Exit

Should ptobably be:

IF %ERRORLEVEL% NEQ 0 GOTO :SCRIPT_ERROR

:SCRIPT_ERROR
echo [0020] %date% %time% Return Code from Install is %ERRORLEVEL% >> %logfile%
Exit

I don't think you need the [] at all in the script.
Answered 08/03/2011 by: jmaclaurin
Third Degree Blue Belt

Please log in to comment
Answer this question or Comment on this question for clarity