MSFN Forum: HFSLIP script problem with KB898461 - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

HFSLIP script problem with KB898461 Setting variable does not work Rate Topic: -----

#1 User is offline   kukris 

  • Member
  • PipPip
  • Group: Members
  • Posts: 106
  • Joined: 28-November 03

Posted 06 January 2011 - 07:05 AM

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.


#2 User is offline   jinjou 

  • Newbie
  • Group: Members
  • Posts: 18
  • Joined: 12-July 10
  • OS:2000
  • Country: Country Flag

Posted 06 January 2011 - 05:58 PM

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


#3 User is offline   kukris 

  • Member
  • PipPip
  • Group: Members
  • Posts: 106
  • Joined: 28-November 03

Posted 09 January 2011 - 07:59 AM

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

#4 User is offline   jinjou 

  • Newbie
  • Group: Members
  • Posts: 18
  • Joined: 12-July 10
  • OS:2000
  • Country: Country Flag

Posted 12 January 2011 - 06:28 PM

View Postkukris, on 09 January 2011 - 07:59 AM, said:

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

View Postkukris, on 09 January 2011 - 07:59 AM, said:

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.

#5 User is offline   kukris 

  • Member
  • PipPip
  • Group: Members
  • Posts: 106
  • Joined: 28-November 03

Posted 13 January 2011 - 02:37 PM

Thanks for the info.

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy