A
Adam Sandler
Hello,
I'm trying to use reg.exe to check to make sure some registry key
values are correct. I want to do this all from a batch file. Let's
say I have the hypothetical registry key of HKLM\SOFTWARE\System Admin
Scripting Guide\Test and Test's value is 5. I want the batch file to
compare the key's actual value
My first thought was I'd have to get what is returned by REG QUERY
into a variable so a comparison could be performed against it...
IF %RETURNVALUE% EQU 5 (
echo Passed!
) ELSE (
echo Failed!
)
When I enter
reg query "HKLM\SOFTWARE\System Admin Scripting Guide\Test" I get this
back:
REG_SZ Test 5
So at least I know I'm using reg.exe correctly. Here's where I get
stuck... how do I get what's returned by REG QUERY into a variable???
I've tried:
set RETURNVALUE=reg query "HKLM\SOFTWARE\System Admin Scripting
Guide\Test"
and this:
reg query "HKLM\SOFTWARE\System Admin Scripting Guide\Test" >
%RETURNVALUE%
Both examples fail miserably. Any help is greatly appreciated -
thanks!
I'm trying to use reg.exe to check to make sure some registry key
values are correct. I want to do this all from a batch file. Let's
say I have the hypothetical registry key of HKLM\SOFTWARE\System Admin
Scripting Guide\Test and Test's value is 5. I want the batch file to
compare the key's actual value
My first thought was I'd have to get what is returned by REG QUERY
into a variable so a comparison could be performed against it...
IF %RETURNVALUE% EQU 5 (
echo Passed!
) ELSE (
echo Failed!
)
When I enter
reg query "HKLM\SOFTWARE\System Admin Scripting Guide\Test" I get this
back:
REG_SZ Test 5
So at least I know I'm using reg.exe correctly. Here's where I get
stuck... how do I get what's returned by REG QUERY into a variable???
I've tried:
set RETURNVALUE=reg query "HKLM\SOFTWARE\System Admin Scripting
Guide\Test"
and this:
reg query "HKLM\SOFTWARE\System Admin Scripting Guide\Test" >
%RETURNVALUE%
Both examples fail miserably. Any help is greatly appreciated -
thanks!