|I'm attempting to use a registry query call that works fine in XP but fails in Vista - after reading through many forums, I'm still at a loss why Vista handles this differently then XP. |
What I'm attempting to do is pass a variable, in this case Servicepack, and then act on that variable. However, Vista always returns the variable is unexpected at this time after the FOR /F call.
The Code is simply:
:: Look for .NET 2.0 SP1
Reg QUERY "HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727" /v SP >NUL
If %ERRORLEVEL%==1 GOTO STARTSP
FOR /F "TOKENS=3 DELIMS= " %%A IN ('REG QUERY "HKLM\Software\Microsoft\NET Framework Setup\NDP\v2.0.50727" /v SP') DO (SET SP=%%A)
IF %SP% GTR 0x0 GOTO ENDSP
Again, works great in XP, in vista is fails. Doesn't matter the key - I have the same problem checking currentversionbuild in the registry - each time it will prompt back with <variable> is unexpected at this time. Any help is appreciated.