Difference between revisions of "Adding Registry Settings"

From WPKG | Open Source Software Deployment and Distribution
Jump to: navigation, search
m
Line 25: Line 25:
 
Normally, you would export this from regedit.exe.
 
Normally, you would export this from regedit.exe.
  
 +
 +
Alternatively, in most modern versions of Windows, there is also a command line registry editor, reg.exe. This can add/delete/modify registry keys without the need for a .reg file.
 +
The matching install command to the above example would be:
 +
<code><pre>
 +
REG ADD HKLM\SOFTWARE\Test /v "Test Setting" /d "1" /t REG_DWORD
 +
</pre></code>
 
----
 
----
  
 
[[Category: Silent Installers]]
 
[[Category: Silent Installers]]
 
[[Category: Changing Windows settings]]
 
[[Category: Changing Windows settings]]

Revision as of 00:13, 3 July 2008

You can use regedit to silently import registry settings. This can be useful to setup defaults for applications, or apply registry tweaks for various Windows settings.

 <package
     id="sample_registry"
     name="Shows a registry entry"
     revision="1"
     priority="0"
     execute="once">
   <check type="registry" condition="equals" path="HKEY_LOCAL_MACHINE\SOFTWARE\Test" value="1" />
   <install cmd='regedit /s "%SOFTWARE%\test_registry.reg"' />
 </package>

And the sample file:

test_registry.reg:

[HKEY_LOCAL_MACHINE\SOFTWARE\Test]
"Test Setting"=dword:00000001
[-HKEY_LOCAL_MACHINE\SOFTWARE\TEST2]

(In Win2k/XP adding "-" in front of a key name causes that key to be deleted from the registry.)

Normally, you would export this from regedit.exe.


Alternatively, in most modern versions of Windows, there is also a command line registry editor, reg.exe. This can add/delete/modify registry keys without the need for a .reg file. The matching install command to the above example would be:

REG ADD HKLM\SOFTWARE\Test /v "Test Setting" /d "1" /t REG_DWORD