I am trying to write a batch file that will determine if a PC has a specific MS Hotfix installed, and is running XP SP2, not SP3.
I so far cannot even get the first part of this to work, due to the reg key having a space in "Windows XP"
The batch file so far:
@echo off
reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Windows XP\SP3\KB932823-v3\>nul
if %errorlevel% EQU 0 goto :nohotfix
if %errorlevel% EQU 1 goto :hotfixpresent
:Hotfixpresent
@echo hot fix is present
pause
:nohotfix
@echo No hotfix is present
pause
the gotos are just placeholders for future code at present.
I get the following error at the moment - Error: Invalid command-line parameters
Anyone got an idea how I can get around this?
thanks,
Rob
You can use a registry key or path that has a space in it (I just did a quick test to confirm it). When you create the name of the attribute in the discovery though, don't include the space. That name is just used within the discovery itself to identify the attribute.
REG_SZ. A null-terminated string. This will be either a Unicode or an ANSI string, depending on whether you use the Unicode or ANSI functions.
How do I check if a key is present in the windows registry. This can be done using reg query key : This command will set %errorlevel% . errorlevel=0 means the key exists.
Use quotes ("
) around key path.
e.g.
reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Windows XP\SP3\KB932823-v3">nul
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With