The export function invoked with the command reg export

an article added by: Dessue Mathenes at 12132007


In: Categories » » Windows registry » The export function invoked with the command reg export

The export function, invoked with the command reg export, exports the registry object specified to a disk file. The object may be a single-level key, such as HKLM\TEMP. Parameters include the name of the key to export and the name (qualified as necessary) of the file to export to. Export is only allowed on the local machine. The command line for export is: REG EXPORT keyname filename As with other registry tools, the registry path to be queried may be a ROOTKEY or a hive, with or without a value entry. The ROOTKEY may consist of one of the following (HKLM is assumed if none is entered):

• HKLM

• HKCU

• HKCR

• HKU

• HKCC

Objects in the key are exported. Here's an example of executing the export command:

   Windows 9:47:58 C:\
   REG export HKLM\TEMP\ myreg.exp   
   The operation completed successfully.
   Windows 9:48:01 C:\ 

Import

The import function, invoked with the command reg import, imports the registry object specified from a disk file. The object may be a single-level key, such as HKLM\TEMP. Parameters include the name of the key to import and the name (qualified as necessary) of the file to import from. Import is only allowed on the local machine. The command line for import is:

REG IMPORT filename

Objects in the exported key are imported. There is no recovery in the event of a user error with this command. Here's an example of executing the import command:

   Windows 9:47:58 C:\
   REG import myreg.exp
   The operation completed successfully.
 Windows 9:48:01 C:\

Load

The load function, invoked with the command reg load <options>, loads the registry object from the file specified. The object must have been saved using the reg save or reg backup command. Options include the name of the file to load from, the registry path to be restored, and an optional machine name (restorations may be made to remote registries). The command line for restore is: REG LOAD FileName keyname [\\Machine]\ As with other registry tools, the registry path to be queried may be a ROOTKEY or a hive, with or without a data key. The ROOTKEY may consist of one of the following (HKLM is assumed if none is entered):

• HKLM

• HKCU

Only HKLM and HKCU may be specified in this command.

Objects in the key are loaded, overwriting existing objects if there are any. Here's an example of executing the load command:

   Windows 9:47:58 C:\
   REG load c:\temp\myco HKLM\TEMP\
   The operation completed successfully.
   Windows 9:48:01 C:\
   reg query HKLM\TEMP /s
   Listing of [TEMP\]
   REG_SZ Version 1.00
 Windows 9:48:35 C:\

Query

The query function, invoked with the command reg query keyname <options>, displays the value of an object (key or value entry) in the registry. A required parameter, keyname, specifies the object to be queried. Options include specifying a query for a specific registry, querying for the default value, and specifying that all subkeys and values be displayed. The command line for query is:

REG QUERY Keyname [/v valuename or /ve] [/s]

As with other registry tools, the registry path may be a ROOTKEY or a hive (with or without a value entry). The ROOTKEY may be one of the following (HKLM is assumed if none is entered):

• HKLM

• HKCU

• HKCR

• HKU

• HKCC

The hive is further qualified to determine the object to be added. Remote registry query may be done by specifying the keyname to be remotely queried, such as \machine\keyname.

Restore

The restore function, invoked with the command reg restore <options>, restores the registry object from the file specified. The object must have been saved using the reg save or reg backup command. Options include the name of the file to restore from, the registry path to be restored, and an optional machine name (restorations may be made to remote registries). The command line for restore is:

REG QUERY FileName RegistyPath [\\Machine]

As with other registry tools, the registry path to be queried may be a ROOTKEY or a hive, with or without a value entry. The ROOTKEY may consist of one of the following (HKLM is assumed if none is entered):

• HKLM

• HKCU

• HKCR

• HKU

• HKCC

Only HKLM and HKU may be specified when copying objects to a remote registry. Objects in the key are restored and overwritten by the information contained in the specified file. Here's an example of executing the restore command:

   Windows 9:39:17 C:\
   REG backup HKLM\Software\MyCo\MyNewApp c:\temp\MyCo
   The operation completed successfully.
   Windows 9:40:20 C:\
   REG restore c:\temp\myco HKLM\Software\MyCo\MyNewApp
   Are you sure you want to replace Software\MyCo\MyNewApp (Y/N) y
   The operation completed successfully.
 Windows 9:40:44 C:\

Save

The save function, invoked with the command reg save <options>, saves the registry object specified to the file specified. Options include the registry path to be saved, the output filename, and an optional machine name (saves may be made on remote registries). The command line for save is: REG SAVE RegistryPath OutputFileName [\\Machine] As with other registry tools, the registry path to be queried may be a ROOTKEY or a hive (with or without a value entry). The ROOTKEY may consist of one of the following (HKLM is assumed if none is entered):

• HKLM

• HKCU

• HKCR

• HKU

• HKCC

Only HKLM and HKU may be specified when copying objects to a remote registry. An example of executing the save command is shown next. In this example, I've saved a small key to the file C:\Temp\MyCo.reg:

Windows 9:16:27 C:\
   REG save HKLM\Software\MyCo\MyNewApp c:\temp\MyCo.reg
   The operation completed successfully.
   Windows 9:18:35 C:\
   dir c:\temp\myco.reg
   Volume in drive C is (c) - Boot drive
   Volume Serial Number is CC56-5631
   Directory of c:\temp
   07/17/99 09:18a 8,192 MyCo.reg
   1 File(s) 8,192 bytes
   183,407,104 bytes free
   Windows 9:19:08 C:\

Unload

The unload function, invoked with the command reg unload <options>, unloads (deletes) the registry object specified. The object must be a single-level key, such as HKLM\TEMP. Options include the name of the key to unload and an optional machine name (objects may be unloaded from remote registries). The command line for unload is:

REG UNLOAD keyname [\\Machine]

As with other registry tools, the registry path to be queried may be a ROOTKEY or a hive, with or without a value entry. The ROOTKEY may consist of one of the following (HKLM is assumed if none is entered):

• HKLM

• HKCU

Only HKLM and HKCU may be specified in this command. Objects in the key are unloaded and are not saved. There is no recovery in the event of a user error with this command. Here's an example of executing the unload command:

Windows 9:47:58 C:\
   REG unload HKLM\TEMP\
   The operation completed successfully.
   Windows 9:48:01 C:\
   reg query HKLM\TEMP /s
   The system was unable to find the specified registry key.
   Windows 9:48:35 C:\

Update

Update is supported in versions of Windows prior to Windows 2000, so this section is of concern only to those working with machines running Windows 95 or 98/Me. On versions of Windows that do not support Backup, including Windows XP, use the Save option instead of Backup Update is invoked with the command reg update <options>, updates an existing object (key or value entry) to the registry. Options include the registry object to be added (with the object's value) and an optional machine name (updates may be made to remote registries). The command line for update is:

REG UPDATE RegistryPath=value [\\Machine]

As with other registry tools, the registry path to be queried may be a ROOTKEY or a hive, with or without a value entry. The ROOTKEY may consist of one of the following (HKLM is assumed if none is entered):

• HKLM

• HKCU

• HKCR

• HKU

• HKCC

The hive is further qualified to determine the object to be added. Below is an example of executing the update command. First I show the original value, then I update the object, and then I show the new value.

Windows 9:00:48 C:\
   REG query HKLM\Software\MyCo\MyApp\Version
   REG_SZ Version 1.00
   Windows 9:01:33 C:\
   REG update HKLM\Software\MyCo\MyApp\Version=2.00
   The operation completed successfully.
   Windows 9:03:47 C:\
   REG query HKLM\Software\MyCo\MyApp\Version
   REG_SZ Version 2.00
   Windows 9:03:53 C:\

legal notice

Our website is not responsible for the information contained by this article. Web-articles is a free articles resource.
Suggestion: If you need fresh, daily updated content for your website, feel free to use our service. Click here for more information.

Useful tools and features

Link to this article from your page    Send this article to you or to a friend
If you like this article (tutorial), please link to it from your web page using the information above.

related articles

1. A value may contain one or in some instances more than one data item
Data Values A value may contain one or, in some instances, more than one data item. The only type of multiple-item value entry that the registry editor can handle is REG_MULTI_SZ, which may contain zero, one, or more strings. Data is stored in a number of different formats. Generally the system uses only a few simple formats, while applications, drivers, and so forth may use more complex types defined for a specific purpose. For example, REG_RESOURCE_LIST is a complex registry type used primarily by drive...

2. The registry has always been the one part of Windows that virtually
Preventing Disaster! Overview Preventing disaster is an important thing to do. No one wants a system failure or to have to reinstall Windows XP. Not the least of your problems will be the issues with product authorization, in that Windows XP, when reinstalled, must be reauthorized! You are reading this tutorial for your own particular reason. Perhaps, as I am recommending, you are here because you want to do everything possible to prevent a disaster with your Windows XP installation. Or maybe you re...

3. You can choose from several methods to back up your registry
Backup Techniques You can choose from several methods to back up your registry, and you can store your backed-up version on a variety of media. Whether you use the Windows XP Backup program or similar utilities, DOS commands, or the Registry Editor, you should first understand what type of file systems your computer network uses. Windows XP supports two different file systems. The first file system, called FAT (File Allocation Table), is identical to the file system used with both DOS and Windows 95/98/Me. The...

4. Once you install a second copy of Windows XP
Customizing the Boot Menu Once you install a second copy of Windows XP, your boot menu will list both copies of Windows XP. This can be confusing since the descriptions will be almost identical. There is a solution: the boot menu can be customized. The boot drive's root directory contains a file called boot.ini. This file includes the boot options for each copy of Windows XP that is installed. Edit boot.ini by following these steps: 1. Open the Windows XP Control Panel in Classic view. 2. Open System Proper...

5. A registry that has been backed up using copy or xcopy is restored
Recovering a Copied Registry A registry that has been backed up using copy or xcopy is restored in the opposite manner from which it was backed up. For example, if you have the NTFS file system, then you have to restart the system using your backup copy of Windows XP. FAT and NTFS When restoring a registry on a FAT-based file system running Windows XP, it's necessary to boot DOS, Windows 95/98/Me, or a second copy of Windows XP. If you have a dual-boot installed (either DOS or Windows 95/98/M...

6. The Windows XP Recovery Console is a tool that allows recovery
The Recovery Console The Windows XP Recovery Console is a tool that allows recovery from a number of failures. Previously, all you could do was boot another copy of Windows XP and hack your way around, replacing files, even registry components, in the blind hope that you would somehow fix the problem. With Windows XP, you have two tools to use: the Recovery Console and the Safe Mode feature. The Recovery Console is a powerful, simple (no, that's not an oxymoron!) feature that is supplied with Windows XP, but it i...

7. What the registry is and the terminology used for its various components
Anatomy of the Registry–The Blood, Gore, and Guts Overview In tutorial 1, we talked a little about what the registry is and the terminology used for its various components. In tutorial 2, we covered backing up and restoring the registry. In this tutorial, we will get into more of the details of what actually is in the registry. If you're only interested in how to use (or recover) the registry, but not what the registry is, it's possible to skip this tutorial. However, if you're unsure about this,...

8. The current control set is copied into the Last Known Good control set
When Is the Current Control Set the Last Known Good Control Set? At some point in the boot process, the current control set is copied into the Last Known Good control set. In Windows XP, the process of replacing the Last Known Good control set is done after the initial logon is performed. This allows the system to catch any problems related to the logon process. HKEY_USERS: Settings for Users Let's take a closer look at SIDs. No, despite what you may think, SID is not the kid down the street;...

9. Windows XP uses only one registry editor
Registry Tools and Tips–Getting the Work Done Overview Windows XP uses only one registry editor. Gone are the separate RegEdit and RegEdt32 editors that existed in Windows 2000. No matter which command you enter in Windows XP, RegEdt32 or RegEdit, the same program (RegEdit, which is called the Registry Editor) will run. Windows XP also has a utility called REG that is included as part of the system installation no more needing to install a separate Resource Kit. This tool is run at the comman...

10. The Registry Editor allows you to quickly create
Creating, Renaming, and Deleting Entries The Registry Editor allows you to quickly create, delete, or rename an entry. Entries may consist of keys, subkeys, or value entries. Creating a New Key You can quickly create a new key by following these steps: 1. Select the hive or key in which the new key is to be created. Either right-click the object or select Edit → New, and then select the type of object to create. 2. The Registry Editor creates the new subkey, giving it a default name of N...