Query Registry Key and add to a system variable or Text file (Batch file)

Author Message
Tom2011

  • Total Posts : 4
  • Scores: 0
  • Reward points : 330
  • Joined: 7/13/2010
  • Status: offline
Query Registry Key and add to a system variable or Text file (Batch file) Tuesday, July 13, 2010 12:18 PM (permalink)
0
Hi all 

I'd like to query the Key / Value:  HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultUserName and add the output to a System Variable (%VariableName%)  



Thx 4 hlp! 
 
#1
    hiyatran

    • Total Posts : 5
    • Scores: 0
    • Reward points : 2170
    • Joined: 8/7/2010
    • Location: Canada
    • Status: offline
    Re:Query Registry Key and add to a system variable or Text file (Batch file) Monday, August 09, 2010 1:34 PM (permalink)
    0
    Can you modify the registry key using the batch file?
     
    #2
      averbon

      • Total Posts : 14
      • Scores: 1
      • Reward points : 12330
      • Joined: 1/16/2002
      • Location: Switzerland
      • Status: offline
      Re:Query Registry Key and add to a system variable or Text file (Batch file) Saturday, September 04, 2010 4:34 PM (permalink)
      0
      Hi Tom2011,
       
      Here's an example:
       
      @ECHO OFF
      :: delims is a TAB followed by a space
      FOR /F "tokens=3 delims=  " %%A IN ('REG QUERY "HKCU\Control Panel\International" /v sCountry') DO SET Country=%%A
      ECHO Country=%Country%
      SETX Country %Country%
       
      Also have a look at the SETX command itself, depending on what registry value you are looking for you can do it directly with SETX.
       
      SETX TZONE /K HKEY_LOCAL_MACHINE\System\CurrentControlSet\    Control\TimeZoneInformation\StandardName
       
      Hope this helps 

       
      Alex Verboon
      Anything about IT
      http://www.verboon.info
       
      #3
        Online Bookmarks Sharing: Share/Bookmark

        Jump to:

        Current active users

        There are 0 members and 1 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