Partager via


Import or Export Keys

Applies To: Windows Server 2008

Warning

Incorrectly editing the registry may severely damage your system. Before making changes to the registry, you should back up any valued data on your computer.

Note

If you make a mistake that results in your computer not starting properly, you can restore the registry. For instructions, see Restore the Registry.

Exporting registry files

To export all or part of the registry remotely, use Registry Editor. Once you have opened Registry Editor, you can export the registry to a text file or to a hive file.

You can use a text editor like Notepad to work with registry files you create by exporting.

You can save registry files in the Windows format, as registration files, as binary hive files, or as text files. Registry files are saved with .reg extensions, and text files are saved with .txt extensions.

Export all or part of the registry

  1. Open Registry Editor. If you want to save only a particular branch, select it.

  2. On the File menu, click Export….

  3. In File name, enter a name for the registry file.

  4. In Save as type, select the file type you wish to use for the saved file (registration file, registry hive file, text file, Windows 98/NT4.0 registration file).

  5. In Export Range, use the radio buttons to select whether you want to export the entire registry or only the selected branch.

  6. Click Save.

Note

Certain parts of the registry are reserved and are not accessible to Regedit.exe. The option to export or import “all” of the registry applies to all of the registry that is accessible to Regedit.exe.

Registry Editor provides a number of commands that are designed primarily for maintaining your system. For example, Load Hive and Unload Hive allow a part of your system to be temporarily downloaded onto another computer for maintenance. Before a hive can be loaded or restored, it must be saved as a key, either to a floppy disk or to your hard disk.

Importing registry files

The Import… command in Registry Editor can import registry files of all types, including text files and hive files.

Import some or all of the registry

  1. Open Registry Editor.

  2. On the File menu, click Import….

  3. Find the file you want to import, click the file to select it, and then click Open.

Note

Certain parts of the registry are reserved and are not accessible to Regedit.exe. The option to export or import “all” of the registry applies to all of the registry that is accessible to Regedit.exe.

Note

In Windows Explorer, double-clicking a file with the .reg extension imports the file into the computer's registry.

Warning

A restored hive overwrites an existing registry key and becomes a permanent part of your configuration. For example, to perform maintenance on part of your system, you can use Export… to save a hive to a disk. When you are ready, you can then use Import… on the File menu to restore the saved key to your system