Modify the Windows registry with registry files
1 January 2001 by Snakefoot | Comment » | Trackback OffThe Registry Editor (Regedit) in Windows is by default associated with registry files having the ".reg" file extension. And when double-clicking such a .reg file, then the registry editor will apply the registry entries specified in the .reg file.
The .reg file is just a standard text file, which can be edited with a text editor like Notepad. The syntax in the .reg file allows one to add, update and remove registry entries from the Windows registry. When using the Registry Editor to export a registry value, then it will save the registry values in a .reg file, and then one can edit the .reg file or import it on a another computer.
To add / change a value in the registry:
The .reg file is just a standard text file, which can be edited with a text editor like Notepad. The syntax in the .reg file allows one to add, update and remove registry entries from the Windows registry. When using the Registry Editor to export a registry value, then it will save the registry values in a .reg file, and then one can edit the .reg file or import it on a another computer.
To add / change a value in the registry:
To delete a value in the registry (Notice the "-"):REGEDIT4
[HKEY_CURRENT_USER\Environment]
"MyEnvironmentVariable" = "Hello"
To delete key with all its sub-keys (Notice the "-"):REGEDIT4
[HKEY_CURRENT_USER\Environment]
-"MyEnvironmentVariable"
Note it is possible to apply a registry file silently without user interaction, by using this command line parameter:REGEDIT4
[-HKEY_CURRENT_USER\Environment]
Note another option for modifying the registry from the command line is to use the utility Reg.exe (Can be found in Ressource Kits). Run Reg.exe /? to see how it is used.Regedit.exe /S <filename>.reg
Tags:
Category:
Updated: 23 September 2007