Auldfart's How To Guides

 

Registry imports and exports

            While editing the Registry is risky, we have to admit it’s also fun. Digging through the Registry enables you to tweak and tune settings not usually exposed within the Windows interface.

It truly gets you under the hood of your system, which is why so many users want to poke around in there in the first place.

           Prior to even considering making a change, however, you must get into the habit of doing a proper backup. It takes almost no time at all, and can save hours or days of stress if something does go wrong.

In this article we’ll explore various ways of exporting (backing up) and importing (restoring) Registry settings.

Registry tools and concepts


         The main tool used to edit the Registry on a Windows 98, Me or XP system is the Registry Editor, Regedit.exe. The easiest way to get to this tool is from the Run command – simply type regedit, click OK and away you go.

    Behind getting into the details of importing and exporting settings, it’s important to have an understanding of the Registry structure. While closely resembling a folder and file structure similar to browsing the contents of a disk, the terms used to describe Registry elements are different.

             At the top level of the Registry, five main folders exist (six in Windows 98/Me), known as hives (or sometimes as root keys). Each contains different types of information, ranging from user settings to general system settings to security information.

Any folder beneath a hive is known as a key, with a folder within a key known as a sub-key. Simply calling all folders ‘keys’ is also acceptable.

            Within any given folder (key), you’ll find values. Values are the placeholders for the actual Registry settings, known as data. For example, a value called UserName might consist of data like ‘Joe Bloggs’.

When editing the Registry, you’re changing the data associated with existing values, although sometimes you may be adding new values and their associated data.

Export methods


        The Windows Registry Editor makes it simple to export settings. Depending on the OS you’re running, your options will be different, however. In Windows 98/Me, you have the option of exporting Registry settings into a Registration file, more commonly known as a REG file.

             At the most basic level a REG file is a formatted text file that contains information about values and data stored in the Registry, as well as the associated path to where the values and data are stored.

The benefit of this file type is that Registry values can be imported by double-clicking the file and confirming the action.

             If you’re running Windows XP, Registry information can be exported in four main formats: Windows XP REG files, Registry hive files, text files and as Windows 9X/NT 4.0 REG files (for backwards compatibility).

          Only the first three types should concern you, since it’s unlikely that you’ll be trying to migrate settings from XP to a Windows 9X or NT 4.0 system.

       Exporting to a REG file in Windows XP is similar to doing the same in Windows 98/Me, producing a formatted text file that can be imported quickly. Choosing to export to a Registry hive file is a different option – it creates a binary image of whatever key(s) you have specified for export.

          However, you cannot view these files in a traditional text editor like Notepad. The last option, exporting to a text file, creates a text file in a manner similar to a REG file, but cannot be imported – use this option for documenting settings rather than as a backup.

Export in XP


         To export Registry settings in XP, browse to the particular key that you want to export (sub-keys, values and data will be included) and then choose Export from the File menu.

 After providing a file name, click the Save as Type drop-down menu, select the appropriate option and click Save.

Import methods


               Importing Registry settings from an existing file can be as simple as double-clicking a REG file, or using the Import feature from the File (or Registry) menu in Registry Editor.

While importing settings isn’t difficult, it’s helpful to understand the implications of importing different types of files.

            When you import a REG file, any settings that are not found in the Registry are added. Where data settings in the file differ from existing settings, those settings will be changed to reflect the contents of the file being imported.

             This is an important consideration. For example, let’s say that you wanted to remove a set of values and data that you had added manually using Registry Editor – double-clicking the REG file that you created before making the changes would not remove those settings.

When a REG file is imported, it simply merges new data into the Registry and changes existing values as required.

          This is one of the reasons why exporting the Registry as a hive file in XP is a great idea. Although you cannot edit these files, they create a binary snapshot of all Registry settings.

           Then when you choose to import a hive file, all existing settings in that particular key are completely overwritten with the contents of the hive file.

              For example, let’s say that you were to export to a hive file, add entries to that same key using Registry Editor, and then import the hive file – the whole key would be overwritten with the settings in the hive file, along with those manual additions.

 Importing hive files is a quick way to get back where you were in cases your manual edits go awry.

Other back-up/restore methods


              Using the export function of Registry Editor is a great idea prior to making any Registry edits. However, you could also create a restore point using System Restore in Windows XP or Me prior to making Registry changes, since the restore point will contain your settings.

           Along the same lines, Microsoft does not recommend using Registry Editor as the primary method of backing up and restoring the entire Registry in XP. Instead, you should use the Backup tool to both backup and restore what is known as System State data.

             Note that System State data includes the Registry as well as important system files, so the backup is typically much larger. However, it’s a more reliable way to handle Registry back-up and restore operations.

              If you’re running XP Home edition, the Backup utility is not installed by default, but is included on the XP CD. See the walkthrough below for installing the Backup utility and backing up System State data.


Back up System State data

Properly back up the Registry on an XP Home system using the Backup utility



            Backup isn’t installed on XP Home by default. Insert your XP CD and browse to the \valueadd\msft\ntbackup folder. Double-click the NTBACKUP.MSI file to begin. Once the installation is complete, click Finish.


              Press Start, and then select All Programs, Accessories, System Tools, and then choose Backup. The Welcome to Backup or Restore Wizard window will appear, as shown above. Click Next.


              At the Backup and Restore screen, ensure that Back up files and settings is selected, and click Next. At the What to Back Up screen, select Let me choose what to back up and press Next.


       At the Items to Back Up screen, click My Computer, System State. This will display the System State backup’s components, including the Registry. Check the checkbox next to System State and then press Next.


              At the Backup Type, Destination and Name screen, click Browse to choose a folder where the backup should be saved. In the back-up name text box, give the backup a descriptive name and press Next.


              On the Completing the Backup or Restore Wizard screen, click Finish. Once the backup is complete, check the location specified to ensure that the System State back-up file specified exists.