Exporting and Importing Registry Data
Creating registry values is simple but tedious work, especially if you regularly need to create the same keys (when building new computers, for example). To solve this issue, it is possible to export and import registry data. To demonstrate this, left click on the CompTIA key in the left hand pane, open the Registry menu and click the Export Registry File option. A dialog prompting for a filename appears type C:\CompTIA.reg as the save location. Before clicking the Save button, look carefully at the bottom of the dialog. Two options are available in the Export Range frame All or Selected Branch. Choosing All here causes the entire Registry to be exported, so ensure the Selected Branch radio button is selected and the branch location is correctly set to the CompTIA key. Click Save to export the file.
Our registry key has been safely exported, so we can now delete it. Right click on it, and select the Delete option from the popup menu.
Before clicking Yes to the confirmation prompt, double check you have selected the correct key! Once you click Yes, the key will be removed and cannot be recovered!
The next task is to restore the key from the export file. Exit RegEdit, open Explorer and navigate to the root of the C: drive where the exported CompTIA.reg file was saved. Before importing it, we will look at how a .reg file is structured. Right click it, and select Edit from the popup menu. Notepad will open and load the file.
As you can see, a .reg file is a plain text file structured in a specific manner. The first line of a .reg file always specifies the version of RegEdit used to create it. Windows NT 4 will create files with version 4 of RegEdit, whilst Windows 2000 and XP both use version 5. If you experience issues importing a .reg file that you know is valid, check it contains this version string as the first line of the file.
After the version string, there is a single blank line followed by the location of the exported registry key in square brackets. Underneath this are the values exported from the key. It is perfectly safe to edit the values in a .reg file before importing it again.
Close Notepad, and double click the CompTIA.reg file. You will be prompted to confirm whether to import the registry data or not.
Click Yes to complete the import. Open RegEdit again by typing regedit at the Start Run prompt, and navigate to the HKLM\Software key. The CompTIA key has reappeared, along with the keys we created.
Exporting and importing registry files is an important and useful technique to be aware of. Editing the Registry is a common task when troubleshooting application issues, and it is important to be able to take a point-in-time backup of the keys you are modifying. Doing so allows you to restore the Registry to a known state, as it is all too easy to magnify a problem when manipulating Registry values directly.
Before continuing with this chapter, take some time to browse through the other keys and values within the HKLM\Software and HKCU\Software keys. These are the central storage points for application data, and it is important to get a feel for the type of values and key structures used.
Home - Table Of Contents - Contact Us
CertiGuide to A+ (A+ 4 Real) (http://www.CertiGuide.com/apfr/) on CertiGuide.com
Version 1.0 - Version Date: March 29, 2005
Adapted with permission from a work created by Tcat Houser et al.
CertiGuide.com Version © Copyright 2005 Charles M. Kozierok. All Rights Reserved.
Not responsible for any loss resulting from the use of this site.