I've run into a problem in which my experience (and Google-fu) have let me down.
Basically, I need to push out KB968730 to a couple hundred clients or so. Naturally, would like to check for the installation of the hotfix before kicking off the install. Sadly, I need to do this with a script and a GPO, rather than a proper system like SCCM. Not normally something that would give me any issues, but, there seems to be a catch.
The catch is that the path to the registry key this hotfix installs has a bloody space in it. Specifically, it installs to
No surprise then, that the standard batch file/CMD command
reg.exe query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB968730 throws a syntax error and messes up the installation check part of my batch file - it's seeing the second part of the path as a second argument. So, of course, I tried encapsulating the path in double quotes, no joy. Single quotes, no joy. Threatening my operating system and/or Microsoft also did not produce results.
After some Googling and expletives, I found what seems to be a solution to this, but can't quite get it working, for some reason I can't figure out. (Undoubtedly because my coding skills are weak these days and string tokenization threw me for a loop at the best of times.)
Seems like what I want to use is something like:
for /f "Tokens=2,*" %%a in (‘reg.exe "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix\KB968730" /v Path’) do (set xpath=%%a) and then work with
%xpath%, but that's not working. Having tokens set to 1 gives me path before the space, set to 2 gives me the path after the space, and I can't figure out how to append the one value to the other. Particularly frustrating since all the answers I've seen said "thanks, it worked!!!" or similar. *(With the caveat that you remove one
% when executing directly on the command line.)
Anyone know what I'm messing up here?
Alternately, if anyone still uses VBS and knows how to do it with that, I'd happily jump at that option. (No PowerShell, though, on account of our XP client not having it installed.)
P.S., if this is better suited for StackOverflow, I've no issues with it being migrated, but my initial thought was that "we" don't appreciate developers coming in here and asking [to us] trivial questions about setting up their dev machines, so I thought they'd probably feel the same way about my question.