Jump to content

HFSLIP script problem with KB898461


kukris

Recommended Posts

Hi everyone,

I did a new installation, but Windows update installer package KB898461 (which is present in the HF folder) and several other updates were missing. So I checked the HFSLIP script and found this on line 482:

IF EXIST HF\*898461*.exe (
FOR /F %%I IN ('DIR/B/OD HF\*898461*.exe') DO SET PKGINST=%%I
ECHO !PKGINST!&MD TEMP&START/WAIT HF\!PKGINST! /Q /X:TEMP
...
)

I tested this section with this test:

@ECHO ON
IF EXIST HF\*898461*.exe (
FOR /F %%I IN ('DIR/B/OD HF\*898461*.exe') DO SET PKGINST=%%I
ECHO PKGINST=%PKGINST%
)
PAUSE

When I run it, I get this output:

C:\hfslipWxp>SET PKGINST=WindowsXP-KB898461-x86-DEU.exe
PKGINST=

The variable PKGINST is set, but in the next line, the contents of the variable is gone.

Has anyone a solution for this?

I'm using Windows XP Pro SP3 German and checked my source with Mimo's File-Checker.

Link to comment
Share on other sites


I haven't tried your test myself, but just off the top shouldn't this:

ECHO PKGINST=%PKGINST%

be this?:

ECHO PKGINST=!PKGINST!

Also, you'll need to add this at the beginning of your test:

SETLOCAL EnableDelayedExpansion

So, like this overall:

@ECHO ON
SETLOCAL EnableDelayedExpansion
IF EXIST HF\*898461*.exe (
FOR /F %%I IN ('DIR/B/OD HF\*898461*.exe') DO SET PKGINST=%%I
ECHO PKGINST=!PKGINST!
)
PAUSE

Link to comment
Share on other sites

Thanks jinjou,

that worked. I always thought that referencing the contents of a DOS variable was done this way:

ECHO PKGINST=%PKGINST%

What is the difference with exclamation marks or when do I have to use that?

Greets

Kukris

Link to comment
Share on other sites

I always thought that referencing the contents of a DOS variable was done this way:

ECHO PKGINST=%PKGINST%

You're correct, this is the right way to do it, except when you set the value of a variable in a block (typically, an IF or a FOR statement).

What is the difference with exclamation marks or when do I have to use that?

You can find an explanation for all this in the online help text of the commands.

Try these commands at a prompt:

SET /?

HELP

HELP SET

HELP SETLOCAL

Also, try these to find additional important information:

HELP CALL
HELP FOR
HELP IF

However, this matter doesn't apply to your original issue, and is not related to this forum. If you have any further questions along this line, you should post to here.

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