Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 4. Windows XP Applications and Tools > Registry Console Utility

Registry Console Utility \windows\system32\reg.exe

A command-line utility to access and modify portions of the Windows Registry.

To Open

Command Prompt reg

Usage

reg command [options]

Description

The Registry Console Utility performs all of the functions of the Registry Editor, discussed later in chapter and in Chapter 8, but can be used from the command line. It also does a few things Registry Editor can’t do, such as making a duplicate of a registry key (via copy, below). To use the Registry Console Utility, type reg, followed by one of the following commands and any applicable parameters:


query keyname [/v valuename | /ve] [/s]

Displays the data stored in a Registry value, where keyname is the full path of a registry key and valuename is the name of the value to query. Omit /v valuename to display list of all the values in keyname or specify /ve to query the (Default) value. Include /s to query all subkeys and values as well. Keyname can also include the name of a remote computer like this: query computer\keyname.


add keyname [/v valuename | /ve] [/d data] [/t typ] [/s sep] [/f]

Adds a new value. The keyname, /v, and /ve options are the same as with query, above. The /d option assigns data to the new value; if omitted, the new value will be empty. Use /t to specify the data type for the value; if omitted, a string value (REG_SZ) will be added. Use the /s option to specify a separator, used if you’re creating a REG_MULTI_SZ value. If the value being added already exists, you’ll be prompted to overwrite, unless the /f parameter is specified.


delete keyname [/v valuename | /ve | /va] [/f]

Deletes an existing value. All options are the same as with add, above. The /va parameter instructs the Registry Console Utility to delete all values in the specified key.


copy keyname1 keyname2 [/s] [/f]

Duplicates a key and all its values, where keyname1 is the full path of the source key and keyname2 is the full path of the new key. Specify /s to include all subkeys and their values and use the /f option to force the copy without first being prompted.


save keyname filename

Saves a portion of the registry into a file, where keyname is the full path of the key to save, and filename is the name of the new hive file. Note that this command does not create a registry patch (.reg) file, but a binary hive file that can only be read with restore, below. Note also that the root key in keyname must be a four-letter abbreviation (e.g., HKLM, HKCU, HKCR, HKU, or HKCC).


restore keyname filename

Reads a hive file (created with save, above) into the Registry. Note that keyname doesn’t have to be the same as the key from which the file was originally created. See the notes for save for details. Only works on the local machine.


load keyname filename

Installs a hive file (created with save, above) onto the Registry. Load is similar to restore, above, except that any changes to the loaded keys or values are stored back into the hive file specified by filename. With restore, on the other hand, the new keys are added to a pre-existing hive.


unload keyname

Uninstalls a key, keyname, that has been installed with load, above.


compare keyname1 keyname2 [/v valuename | /ve] [/s] [ output ]

Compares two keys or values. The keyname1 and keyname2 options are the same as with copy, above. The /v, /ve, and /s options are the same as with add, above. The output option can be /oa (output all differences and matches), /od (output only differences), /os (output only matches), or /on (no output); when omitted, /od is assumed. See reg compare /? for more information.


export keyname filename

Creates a registry patch (.reg) file, filename, from the key at keyname. Registry patches can be imported with import, below, or by double-clicking in Explorer (via Registry Editor).


import filename

Imports a registry patch (.reg) file, filename, created either with export, above, or with Registry Editor.

Notes

  • All of the concepts in terms discussed here are explained in Chapter 8.

  • Many of the functions discussed here can only be accomplished with the Registry Console Utility and are not possible with Registry Editor. Among them are the copy, save, restore, load, unload, and compare commands.

See Also

“Registry Editor”, Chapter 8

  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint