Jump to content

!VARIABLES! not parsing in command file


lek

Recommended Posts

Hi all,

I'm sure I must be missing something totally obvious here, but I can't seem to find the cause of the problem I'm having. The problem is that when running a command script (.cmd file), variable names that are enclosed in exclamation marks (like !HFSLP! or !VERSION!) don't get parsed (i.e. they do not return the value that the variable contains). Hence, statements like:

SET /A HFSLP=!HFSLP! + 1

fail completely, and since these are used a lot in the HFSLIP script, the entire slipstream process fails.

I have tried the April 1 and April 21 versions of HFSLIP, and both give the same result. An example of the output shown:

Expanding WindowsInstaller-KB893803-v2-x86.exe
File not found - *.*
0 File(s) copied
A subdirectory or file TEMP\UPDATE already exists.
0 File(s) copied
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
Integrating WindowsInstaller-KB893803-v2-x86.exe
File not found - TEMP
0 File(s) copied
199 COMPLETE
The system cannot find the file specified.
Processing Windows Update
FINDSTR: Cannot open WORK\INFS\199.INF
Completed WindowsInstaller-KB893803-v2-x86.exe

I also tried an older HFSLIP version (dated Februari 3rd, 2006) and get the same results. This version had previously run without problems on the same system, so something must have been changed to the OS or to my system configuration. For the heck of me, I can't think of anything what that might be. I am running XP Pro SP2, with all hotfixes installed.

Any suggestions?

Thanks!

PS: Just curious: why are exclamation marks used around those script variables anyhow? I always thought that one is supposed to use percentage marks (like %VARIABLE%). When changing the exclamation marks to percents, the offending statements run fine...

Edited by lek
Link to comment
Share on other sites


I've located the cause of the problem... and it weren't the exclamation marks after all. Serves me right for trying to do something intelligent on a Friday night. :P

What had happened was that when moving some of the source files around my file system, XP somehow decided to rename the file "WIN51IP.SP2" (uppercase) to "win51ip.sp2" (lowercase). That resulted in an unintended effect in the following line:

IF "%VERSION%"=="XP" (

SET T1=TommyP's HFSLIP XP/WMP10/WUA20 Hotfix Slipstreamer

TITLE %T1%

SET PREP=%~dp0

rem SET SP=SP2

if exist source\*.sp* (for /f "tokens=1,2 delims=." %%i in ('dir /b source\*.sp*') do set SP=%%j) else (set SP=SP0)

CALL :SLIPSTREAM

)

...because the SP variable is set to "sp2", instead of "SP2". Later, in the "BANDAIDXP2K3" routine, the problem occurs:

IF "!SP!"=="SP0" SET SPUPDATE=SP1

IF "!SP!"=="SP1" SET SPUPDATE=SP2

IF "!SP!"=="SP2" SET SPUPDATE=SP3

IF "!SP!"=="SP3" SET SPUPDATE=SP4

IF "!SP!"=="SP4" SET SPUPDATE=SP5

IF "!SP!"=="SP5" SET SPUPDATE=SP6

IF "!SP!"=="SP6" SET SPUPDATE=SP7

Here, the SPUPDATE variable is supposed to get set to "SP3", but remains undefined because SP gets tested for uppercase values, but contains a lowercase one. This leads to further pain and suffering further along the execution path.

Anyhow, thanks for the quick reply; hope this clarifies things. Cheers.

Edited by lek
Link to comment
Share on other sites

It would've affected other script portions as well so adding a /I to those IF command lines alone wouldn't be enough. I updated the first script section in lek's post (and its surroundings). Try the latest test release.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...