How to Back Up and Restore the Windows Registry

written by: Leon Gualee; article published: year 2006, month 10;


In: Categories » Computers and technology » Microsoft OS family » How to Back Up and Restore the Windows Registry

Before diving into Registry modifications, I'll talk about backing them up. Every computer book I've seen stresses these facts:

1.
There is no Undo key in the Registry Editor.

2.
Improper changes to the Registry can keep Windows from booting, or can make subsystems fail to work.

3.
You should always perform a system backup, or at least back up the entire Registry before you make any changes to the Registry.

In the spirit of full disclosure, I have to tell you that items 1 and 2 are completely true, and I've never followed the advice of item 3 myself. Maybe I'm an idiot, maybe the warnings are a bit too strident, or maybe it's something in between. But, especially with Windows XP's System Restore feature to do all of the work for you, there's really no harm in taking a few extra moments to protect yourself against a preventable bad outcome.

You can back up the Registry in Windows XP in five ways: You can back it up as part of a regular disk backup; you can selectively back up portions of the Registry by exporting the keys with the Registry Editor; you can create a System Restore Point; you can use the command-line application REG.EXE; or you can use a special-purpose Registry backup program.

Registry Backup and Recovery with Windows Backup

Windows XP includes a simple, straightforward backup and restore utility called NTBackup that you can use to back up your entire system, including data files, system files, and Registry files.

To back up only the Registry, follow these steps:

1.
Click Start, Run, and type ntbackup in the open box. Click OK.

2.
If the backup utility starts in the wizard interface, click the Advanced Mode option in the body of the main paragraph to take you out of the wizard and display the tabbed Backup Utility interface.

3.
Select the Backup tab and select the System State option in the tree in the left pane. The System State is composed of the Registry, the boot files, the Active Directory files, and the certificates.

4.
Enter a backup filename in the designated box. It's best if you save this backup in another computer's shared network folder, or on a removable disk.
5.
Click the Start Backup button. You are then prompted for a backup description. Select the option to Replace the Data on the Media with This Backup.

6.
Click the Advanced button and uncheck the option to Automatically Backup System Protected Files with the System State. This ensures that you're grabbing only a backup of the Registry and cuts your backup file down from 1GB to somewhere between 10 and 50MB, depending on your Registry size. Click OK, and then click Start Backup.

7.
The Backup Progress dialog displays. When the job completes, click Close.

To restore the Registry from a backup made with NTBackup, follow these steps:

1.
Click Start, Run, and type ntbackup in the open box. Click OK.

2.
If the backup utility starts in the wizard interface, click the Advanced Mode option in the body of the main paragraph to take you out of the wizard and to display the tabbed Backup Utility interface.

3.
Select the Restore and Manage Media tab.

4.
Select Tools, Options, Always Replace the File on My Computer because your Registry files already exist. Click OK.

5.
In the right pane, expand the list of catalogued backups until you find the one you want to restore. If you do not see your backup job in the list, click Tools, Catalog a Backup File, and enter the location for the backup file in the resulting box. Select the applicable backup set and select System State in the left pane.

6.
Click Start Restore. A dialog warns you that System State is always restored to the current location. Because that's what you want to happen, click OK.

7.
Click OK on the Advanced Options dialog.

8.
Confirm the proper name and location of the backup set, and then click OK.

9.
When the restore completes, you must restart the system to successfully load the restored Registry files.

Caution

Do not test this procedure out on a properly functioning system. This is a drastic procedure meant only for recovering from Registry-related disasters and should not be attempted unless absolutely necessary, or if you are working on a lab machine specifically set up to test this process

Exporting and Importing Registry Files with the Registry Editor

The Registry Editor that is included with Windows XP allows you to selectively export anything from a single subkey to an entire Registry key. If you're performing significant modifications, this is a good way to ensure that you can figure out what the original values were if you need to roll back your changes.

To back up a key including all subkeys and values, follow these steps:

1.
Click Start, Run, type regedit, and click OK.

2.
Select the key you want to back up from the list in the left pane.

3.
Select File, Export.

4.
In the Common File dialog, select a directory and enter the filename where you would like to save the exported Registry entries.

Caution

The default extension for an exported Registry file is .REG. Double-clicking on a .REG file automatically imports the file into the Registry after providing a single confirmation box. To prevent too-easy accidental Registry imports, I suggest you save exported Registry files as text files, with the .TXT extension.

5.
Select Selected Branch in the Export Range option box, and click Save.

Because this is a plain-text file, you can open it in Notepad to see the contents. I often use this method to deploy changes to several computers: I make limited Registry changes on a single system, export the change as a .REG file, edit the file down to just the modified entries, move the file to a network folder, and import the file on other machines.

Importing a Registry file exported through the Registry Editor is just as straightforward as exporting:

1.
Click Start, Run, type regedit, and click OK.

2.
Select File, Import.

3.
In the Common File dialog, enter the filename containing the data you want to import.

4.
Select Open.

Importing a Registry setting through the Registry Editor overwrites existing keys or values and adds missing keys or values, but it does not delete extra keys or values that are not contained in the Registry file. However, you can use a Registry file to explicitly specify subkeys or values to delete.

Note

Remember when I suggested changing the extension of the previous Registry file from .REG to .TXT so you wouldn't accidentally import the settings? You can use the inverse to enable a two-step, REGEDIT-free Registry file import. Simply rename the Registry file you want to import with a .REG extension. Then double-click the Registry file to quickly import the contents of the file into your Registry. You can't back out of the import after you've confirmed it exists, so ensure you know what you're importing before you run the REG file.


Backing Up with System Restore

A System Restore Point allows you to restore your computer to a previous state, rolling back changes to device drivers, system files, and the Registry. By manually requesting that Windows create a Restore Point before you forage into the Registry, you can make changes and easily roll them back if something doesn't work.

Command-Line Backup and Restore Using reg.exe

A command-line Registry manipulation tool called reg.exe is included with Windows XP. This tool is useful for selectively backing up or restoring specific Registry subkeys. Numerous functions are available in reg.exe, including Registry exporting and importing.

Note

You can do quite a few things with reg. Use the command reg /? for a complete usage syntax of the command.


To back up a Registry key using reg.exe, use the following syntax:

reg export rootkey\subkey filename  
For rootkey, you can use the abbreviations HKLM, HKCU, HKCR, HKU, or HKCC. Subkey must be the full name of a Registry key under the selected root. Filename is the name of the file to which you want to save the exported data.

To restore a Registry key using reg, use the following syntax:

reg import filename  
When importing, filename can be any file created by reg export, from the regedit Registry Editor's Export command, or created manually with a text editor.

legal disclaimer

1) Our website is not responsible for the information contained by this article as well for any and all copyright infringements by authors and writers. E-articles is a free information resource. If you suspect this article for any copyright infringements, please read the Terms of service and contact us to investigate the problem.
2) The E-articles directory team is not responsible for inaccuracies, falsehoods, or any other types of misinformation this tutorial may contain and will not be liable for any loss or damage suffered by a user through the user's reliance on the information gained here. Please read the Terms of service

Useful tools and features

Translate this article to...    Send this article to you or to a friend

Link to this article from your page   
If you like this article (tutorial), please link to it from your web page using the information above. Linking to this page, this is the only way to help us improve our service, the same time providing your visitors with a way to improve their online experience.

related articles

1. The Evolution of Microsoft Windows ~ Windows XP 64 bit Editions
The CPU story is not over, however. The need for processors capable of handling far more than 4GB of memory has led to development of two competing 64-bit architectures. Intel developed and promoted a 64-bit architecture called IA-64 or Itanium, intended primarily for database and network server computers. Advanced Micro Devices also produced a 64-bit architecture, called x64 or AMD-64. Intel is now manufacturing chips that use the x64 instruction set. x64 processors typically yield better performance than Itanium running 32-bi...

2. Managing Startup Programs under Windows XP
Besides ensuring that your computer has adequate memory, one of the next best ways to improve your subjective experience of Windows' speed is to make the logon process faster. The logon process can be greatly slowed by large numbers of programs that are launched automatically upon logon; the desktop and Start menu don't respond until all of the login programs have been activated. Keeping the list of startup programs short is a constant struggle, however. To hide the fact that many common programs are poorly written and ...

3. How to Configure Automatic Updates in Windows XP
Automatic Updates is a mechanism with an awkwardly plural-sounding name by which Microsoft or corporate network managers distribute critical security updates to Windows users. Fixes sent by this means are considered so important for adequate security in the hostile Internet environment that Microsoft prefers that you configure it to download and install the updates, and if necessary even restart your computer without your being aware of it. There are four levels of Automatic Updates protection to which you can subscribe:...

4. MS DOS Versus PC DOS
With modern PCs having a very high level of standardization and compatibility, today it is easy to see how Microsoft can market complete packaged operating systems that will install and work unmodified on practically any PC you can purchase or build. Without the standardization and compatibility we have come to depend on, different specific "flavors" of a given operating system would be required for specific different hardware. That is exactly how things were back in the early '80s when the IBM PC was introduced. Many o...

5. How to make your PC Available for Remote Desktop Connection
To use Remote Desktop to reach your computer from the Internet, both the computer and your Internet connection must always be up and running. In addition, you must be able to make connections from the outside world to your computer, so there are additional requirements: If you use dial-up Internet service, you'll need someone at home to establish the connection before you can connect to your computer. If you use cable or DSL Internet service, you must either have a static IP address ass...

6. How to Update DirectX ~ Advantages
Although most Windows applications place fairly low demands on the display system, putting up fairly static displays and updating them relatively infrequently, interactive games and video displays are very graphics intensive. Game players pay big bucks for fps, or frames per second, which is a measure of how fast the hardware and software can generate new images as the scene changes and objects move. Under about 30fps, the image flickers and motion is noticeably jerky. Beyond 30fps, faster updates aren't noticeable, and the e...

7. Using Simple File Sharing in Windows
Although most home users are typically happy letting anyone at any computer read or modify any file, business users need to restrict access to files with payroll, personnel, and proprietary information. Windows XP and its predecessors, Windows NT and Windows 2000, were primarily designed for business use, so they require usernames and passwords for identification, and have a security system that lets computer owners restrict access to sensitive files on a user-by-user and file-by-file basis on each computer. Unfortunate...

8. The Evolution of Microsoft Windows ~ The Windows 9x Family
By the mid-1990s, processor power had increased and memory prices had decreased dramatically since Windows' original release. The Internet had also sprung onto the world stage, from an academic tool to an instrument of global communication and commerce. (You may recall that Windows 3.1 did not even include support for the TCP/IP network protocol used on the Internetyou had to purchase it from a third-party vendor.) Users' expectations likewise had grown with computers' capabilities, and desktop publishing, graphics editing, and...

9. How to install Windows and Installation Types
Deciding on the type of installation to perform is dictated by many factors, such as the following: Is there an operating system currently installed? If so, do you want to preserve settings and configurations, or start from scratch? Will the installation be performed interactively or remotely? How many computers are to be installed at a single time? Is your network arranged in a domain model using Active Directory? These are ...

10. How to adjust Text Icons and Window Element Sizes
If you find the items on the screen difficult to read or see, you can either lower the screen resolution, which makes everything larger but blurrier, or ask Windows to make the elements themselves larger while keeping a crisper, high screen resolution. There are two ways you can do this. Here's the first procedure: 1. Right-click the Desktop and select Properties. 2. Save the current screen settings so if you're unhappy with the results, you can back the changes out. Select the Themes tab, click Save As, and enter ...