Home All Groups Group Topic Archive Search About

Command to add registry entry

Author
25 Mar 2009 2:06 PM
Jasper Recto
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

Author
25 Mar 2009 2:51 PM
John John - MVP
Yes, absolutely.  There are several ways that can be used.  Start here:

How to add, modify, or delete registry subkeys and values by using a
registration entries (.reg) file
http://support.microsoft.com/kb/310516

Distributing Registry Changes
http://technet.microsoft.com/en-us/library/bb727154.aspx

John

Jasper Recto wrote:
Show quoteHide quote
> 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
>
>
Are all your drivers up to date? click for free checkup

Author
25 Mar 2009 7:56 PM
John Wunderlich
Show quote Hide quote
"Jasper Recto" <jrect***@yahoo.com> wrote in
news:eE7AeLVrJHA.2484@TK2MSFTNGP03.phx.gbl:

> 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\Tr
> usted 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
>
>

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
Author
26 Mar 2009 12:04 AM
Al Dunbar
Show quote Hide quote
"John Wunderlich" <jwunderl***@lycos.com> wrote in message
news:Xns9BD983B9914Dwunderpsdrscray@138.126.254.210...
> "Jasper Recto" <jrect***@yahoo.com> wrote in
> news:eE7AeLVrJHA.2484@TK2MSFTNGP03.phx.gbl:
>
>> 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\Tr
>> usted 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
>>
>>
>
> 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.

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
Author
26 Mar 2009 1:51 AM
John Wunderlich
Show quote Hide quote
"Al Dunbar" <aland***@hotmail.com> wrote in
news:uiYzv6arJHA.4996@TK2MSFTNGP04.phx.gbl:

>
> "John Wunderlich" <jwunderl***@lycos.com> wrote in message
> news:Xns9BD983B9914Dwunderpsdrscray@138.126.254.210...
>> "Jasper Recto" <jrect***@yahoo.com> wrote in
>> news:eE7AeLVrJHA.2484@TK2MSFTNGP03.phx.gbl:
>>
>>> 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\
>>> Tr usted 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
>>>
>>>
>>
>> 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.
>
> 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

True... but if it's part of the login script, it will be
incorporated as each user logs in.

-- John

Bookmark and Share

Post Thread options