This article will show you how to configure the Registry with a .reg file and some operations with this file type.
Configure the Registry with the .reg file
The .reg file is a plain ASCII text file that can be created or read by Notepad or any text editor, and you can also include it in the Registry to perform the configuration. Create the .reg file very easily. You can export this file from a portion of the Registry, and then edit it with Notepad or text editors and then put it into the Registry.
The .reg file is especially useful when configuring the same Registry type for many computers using the same operating system.
You can also choose to create some .reg files to copy parts of the Registry that you intend to edit in the Registry Editor. Then, if during the error of the Registry configuration process you can return to the previous Registry configuration by putting the .reg file just saved back into the Registry. This means you can use the .reg file to backup the Registry. In addition, the .reg file is also useful for searching and replacing the Registry because Registry Editor does not integrate this feature. You can do this on the text editor and then merge the file into the Registry.
To create a .reg file from the existing part of the Registry, first launch the Registry Editor, select the key or region of the Registry you want to export, and then go to File select Export. Then enter the name and browse for the address to save the file. You can export a separate key, a branch of the Registry, a group or the entire Registry.
Here is an example after exporting a .reg file from HKEY_CURRENT_USERControl PanelAccessibility branch:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USERControl PanelAccessibility]
[HKEY_CURRENT_USERControl PanelAccessibilityBlind Access]
"On" = "0"
[HKEY_CURRENT_USERControl PanelAccessibilityHighContrast]
"Flags" = "126"
"High Contrast Scheme" = "High Contrast Black (large)"
[HKEY_CURRENT_USERControl PanelAccessibilityKeyboard Preference]
"On" = "0"
[HKEY_CURRENT_USERControl PanelAccessibilityKeyboard Response]
"AutoRepeatDelay" = "1000"
"AutoRepeatRate" = "500"
"BounceTime" = "0"
"DelayBeforeAcceptance" = "1000"
"Flags" = "126"
[HKEY_CURRENT_USERControl PanelAccessibilityMouseKeys]
"Flags" = "62"
"MaximumSpeed" = "80"
"TimeToMaximumSpeed" = "3000"
[HKEY_CURRENT_USERControl PanelAccessibilitySerialKeys]
[HKEY_CURRENT_USERControl PanelAccessibilityShowSounds]
"On" = "0"
[HKEY_CURRENT_USERControl PanelAccessibilitySoundSentry]
"Flags" = "2"
"FSTextEffect" = "0"
"WindowsEffect" = "1"
[HKEY_CURRENT_USERControl PanelAccessibilityStickyKeys]
"Flags" = "510"
[HKEY_CURRENT_USERControl PanelAccessibilityTimeOut]
"Flags" = "2"
"TimeToWait" = "300000"
[HKEY_CURRENT_USERControl PanelAccessibilityToggleKeys]
"Flags" = "62"
As you can see, the .reg file after exporting the first line is Windows Registry Editor Version 5.00 . You cannot change this line because Windows XP uses it to confirm that the file contains Registry information. Earlier versions of Windows such as Windows 95/98 / Me and Windows NT 4 , the first line in the .reg file is REGEDIT4 or Registry Editor 4 .
The names of the sub-keys in the Registry are in brackets [] and they include the full path name to that sub-key, like [HKEY_CURRENT_USERControl PanelAccessibilityKeyboard Response] in this example. Following each sub key is the value and data (enclosed in quotation marks):
[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesMouclass]
"ErrorControl" = dword: 00000001
"Group" = "Pointer Class"
"Start" = dword: 00000001
"Tag" = dword: 00000001
"Type" = dword: 00000001
"DisplayName" = "Mouse Class Driver"
As you can see, quotation marks surround the String value. However, the DWORD value when followed by dword will not be enclosed in quotation marks.
After you edit the value, save the data and save the file, put this .reg file into the Registry by selecting File | Import in Registry Editor . An easier way is to double-click the .reg file you want to apply. After double clicking on the file, Windows XP will ask you to confirm the operation. So when you want to open a .reg file to make absolutely no double-clicking, right-click the file on the file and select Edit or Open With to select the editor you want to use. Or open the .reg file via Notepad or the built-in editor ( File | Open ).
Use the .reg file to delete Key and Value of Registry
You can not only use the .reg file to create new key and value or edit existing key / values, but also can be used to delete key and value.
To delete a key using the .reg file, simply add an oil minus ( - ) in front of the name of the key to delete. For example:
- [HKEY_CURRENT_USERControl PanelAccessibilityKeyboard Response]
When importing that .reg key file will be deleted.Remember that you cannot delete a key in this way before all its sub-keys have been deleted.
You can also delete the value of a key with the .reg file by using the minus sign ( - ) after the = sign. For example:
"BounceTime" = -
When the .reg file is inserted into the Registry, the value will be deleted but the key remains the same.
Protect the Registry by changing the default action when double-clicking on a .reg file
As mentioned above, when you double click on the .reg file you will not be able to open it to edit it and instead import that .reg file into the Registry. This will cause trouble, and may even cause serious problems for the system.
To fix possible problems, it is best to change the action when clicking the .reg file to open it in Notepad (default). You only need to do the following simple actions:
- In Windows Explorer , go to Tools | menu Folder Options | File Types .
- When the File Type dialog box appears, select the Reg item and then click the Advanced button.
- Select the Edit action then click the Set Default button.
- Done, click OK .
By default the editor that the .reg file uses is Notepad, but you can also replace Notepad with another editor so that each double click will open the .reg file in the editor you want to use. . Follow these steps:
- In Windows Explorer , go to Tools | menu Folder Options | File Types .
- When the File Type dialog box appears, click the Edit action of the REG entry.
- Then click the Edit button and enter the file name and the full path of the editor you want to use and end with the % 1 character.
- Then press the OK button twice.