Checking for empty data values in registry

Author Message
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)
0
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
 
#1
    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)
    0
    How about...
    if "%MyVariable%" equ "" (echo Pass) else (echo fail)
     
    #2
      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)
      0
      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.
       
      #3
        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)
        0
        In that case, wouldn't "" equal ""?
         
        #4
          Online Bookmarks Sharing: Share/Bookmark

          Jump to:

          Current active users

          There are 0 members and 3 guests.

          Icon Legend and Permission

          • New Messages
          • No New Messages
          • Hot Topic w/ New Messages
          • Hot Topic w/o New Messages
          • Locked w/ New Messages
          • Locked w/o New Messages
          • Read Message
          • Post New Thread
          • Reply to message
          • Post New Poll
          • Submit Vote
          • Post reward post
          • Delete my own posts
          • Delete my own threads
          • Rate post

          2000-2013 ASPPlayground.NET Forum Version 3.9