john3j04
-
Total Posts
:
7
- Scores: 0
-
Reward points
:
750
- Joined: 7/11/2012
-
Status: offline
|
Checking for empty data values in registry
Thursday, July 26, 2012 1:57 PM
( permalink)
Hello, I have had great success, thanks to this forumn, in creating a batch file that checks registry values and displays whether they are set correctly or not. I now am trying to figure out how to write a check that basically checks a registy value and echos "pass" if it contains no data value. If it does contain data values, it should echo "fail". If anyone could help me it would be greatly appreciated! Thanks, John
|
|
|
|
ndaniels
-
Total Posts
:
132
- Scores: 45
-
Reward points
:
21680
- Joined: 2/24/2006
- Location: The Republic of Elbonia
-
Status: offline
|
Re:Checking for empty data values in registry
Thursday, July 26, 2012 2:39 PM
( permalink)
How about... if "%MyVariable%" equ "" (echo Pass) else (echo fail)
|
|
|
|
john3j04
-
Total Posts
:
7
- Scores: 0
-
Reward points
:
750
- Joined: 7/11/2012
-
Status: offline
|
Re:Checking for empty data values in registry
Thursday, July 26, 2012 2:59 PM
( permalink)
This will not work because there is no data value to be assigned to a variabe. If I do a for /f "tokens=3" %%a in ('REG QUERY "HKLM\System\CurrentControlSet\Control\Session Manager\Subsystems" /v Test ^| Find "REG_MULTI_SZ"') do set %%a=Test, and if Test is supposed to have no data value assigned to it, it will not complete assigning the variable. Is there a way to check for null or something? I dont know what to do in this case.
|
|
|
|
ndaniels
-
Total Posts
:
132
- Scores: 45
-
Reward points
:
21680
- Joined: 2/24/2006
- Location: The Republic of Elbonia
-
Status: offline
|
Re:Checking for empty data values in registry
Thursday, July 26, 2012 3:15 PM
( permalink)
In that case, wouldn't "" equal ""?
|
|
|
|