Command to add registry entry

Discussion in 'Scripting' started by Jasper Recto, Mar 25, 2009.

  1. Jasper Recto

    Jasper Recto Guest

    I would like to add a registry entry into every users HKCU registry. Is
    that possible to do from a batch file?


    If so, what commands do I need to use? I need to add this registry key:

    HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Access\Security\Trusted
    Locations

    And then I need to create another key called Locations under that.
    Then I need to add a string with a value for it.

    Is this possible to do from a batch file?

    Thanks,
    Jasper
     
    Jasper Recto, Mar 25, 2009
    #1
    1. Advertisements

  2. John John - MVP, Mar 25, 2009
    #2
    1. Advertisements

  3. You can do this using the 'reg' command:

    reg add "HKCU\Software\Microsoft\Office\12.0\Access\Security\Trusted Locations"
    reg add "HKCU\Software\Microsoft\Office\12.0\Access\Security\Trusted Locations\Locations"
    reg add /v string "HKCU\ ... \Locations" /t REG_MULTI_SZ /d dataHere

    where, of course, "..." contains the rest of the path.

    HTH,
    John
     
    John Wunderlich, Mar 25, 2009
    #3
  4. Jasper Recto

    Al Dunbar Guest

    That works for the currently logged on user, but the OP wanted to do this to
    "every users HKCU registry" - that doesn't sound like he wants each of them
    to do it for themselves.

    /Al
     
    Al Dunbar, Mar 26, 2009
    #4
  5. True... but if it's part of the login script, it will be
    incorporated as each user logs in.

    -- John
     
    John Wunderlich, Mar 26, 2009
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.