|
REG command
/ve
Query the blank value name.
/s
Specify this parameter to recursively query all subkeys and value names.
/se Separator
Specify a single value separator to search for value names of type REG_MULTI_SZ. If Separator is not specified, "\0" is used.
/f Data
Specify the data or pattern to be searched. If the string contains spaces, use double quotes. If not specified, wildcard characters ("*") are used as the search pattern.
/k
Specifies to search only in item names.
/d
Specify to search only in the data.
/c
The specified query is case sensitive. By default, the query is not case sensitive.
/e
Specifies that only exact matches are returned. By default, all matches are returned.
/t Type
Specify the type of registry to search. The valid types include: REG_SZ, REG_MULTI_SZ, REG_EXPAND_SZ, REG_DWORD, REG_BINARY, REG_NONE. If not specified, all types are searched.
/z
Specifies to include the numeric equivalent of the registry type in the search results.
/?
Display the help of reg query at the command prompt.
Comment
• The following table lists the return value of the reg query operation.
Value Description
0
Success
1
Fail
Example
To display the value of the name value Version in the HKLM\Software\Microsoft\ResKit key, type:
REG QUERY HKLM\Software\Microsoft\ResKit /v Version
To display all the subkeys and values under the HKLM\Software\Microsoft\ResKit\Nt\Setup item on the remote computer ABC, type:
REG QUERY\\ABC\HKLM\Software\Microsoft\ResKit\Nt\Setup /s
To display all subkeys and values of type REG_MULTI_SZ using "#" as a separator, type:
REG QUERY HKLM\Software\Microsoft\ResKit\Nt\Setup /se #
To display the items, values, and data of an exact match and case-sensitive match of "SYSTEM" under the HKLM root of the data type REG_SZ, type:
REG QUERY HKLM /f SYSTEM /t REG_SZ /c /e
To display the items, values, and data of the matching items of "0F" in the data under the root key HKCU of the data type REG_BINARY, type.
REG QUERY HKCU /f 0F /d /t REG_BINARY
To display the value and data of the value name null (default value) under HKLM\SOFTWARE, type:
REG QUERY HKLM\SOFTWARE /ve
reg restore
Write the saved subkeys and keys back to the registry.
Grammar
Reg restore KeyName FileName
Parameter
KeyName
Specify the full path of the subkey to be restored. The Restore operation only works on the local computer. KeyName must include a valid root key. Valid root keys include HKLM, HKCU, HKCR, HKU, and HKCC.
FileName
Specify the name and path of the file whose content will be written back to the registry. The file must be created in advance using the reg save operation with .hiv as the extension.
/?
Display the help of reg restore at the command prompt.
Comment
• Before editing any registry key, use the reg save operation to save the parent and child keys. If the editing fails, you can use the reg restore operation to restore the original sub-items.
• The following table lists the return value of the reg restore operation.
Value Description
0
Success
1
Fail
Example
To restore the file named NTRKBkUp.hiv to the HKLM\Software\Microsoft\ResKit key and overwrite the existing contents of the key, type:
REG RESTORE HKLM\Software\Microsoft\ResKit NTRKBkUp.hiv
reg save
Save a copy of the specified subkeys, keys, and registry values to the specified file.
Grammar
reg save KeyName FileName [/y]
Parameter
KeyName
Specify the full path of the child. To specify a remote computer, include the computer name (in the format\\ComputerName\) and include it as part of the KeyName. Omitting\\ComputerName\will cause the default operation on the local computer. KeyName must include a valid root key. Valid root keys include HKLM, HKCU, HKCR, HKU, and HKCC. If a remote computer is specified, the effective root keys are HKLM and HKU.
FileName
Specify the name and path of the created file. If no path is specified, the current path is used.
/y
No confirmation is required to overwrite any existing file named FileName.
/?
Display the help of reg save at the command prompt.
Comment
• The following table lists the return value of the reg save operation.
Value Description
0
Success
1
Fail
• Before editing any registry key, use the reg save operation to save the parent and child keys. If the editing fails, you can use the reg restore operation to restore the original sub-items.
Example
To save the hive MyApp as a file named AppBkUp.hiv in the current folder, type:
REG SAVE HKLM\Software\MyCo\MyApp AppBkUp.hiv
reg unload
Use the reg load operation to delete part of the loaded registry.
Grammar
reg unload KeyName
Parameter
KeyName
Specify the full path of the subkey to be uninstalled. To specify a remote computer, include the computer name (in the format\\ComputerName\) and include it as part of the KeyName. Omitting\\ComputerName\will cause the default operation on the local computer. KeyName must include a valid root key. Valid root keys include HKLM, HKCU, HKCR, HKU, and HKCC. If a remote computer is specified, the effective root keys are HKLM and HKU.
/?
Display the help of reg unload at the command prompt.
Comment
• The following table lists the return value of reg unload operation.
Value Description
0
Success
1
Fail
Example
To uninstall the TempHive hive in HKLM, type:
REG UNLOAD HKLM\TempHive
caveat
• Edit the registry directly only when there is no other choice. The registry editor ignores standard security measures, causing these settings to reduce performance, damage the system, and even require users to reinstall Windows. You can safely change most registry settings using programs in the Control Panel or Microsoft Management Console (MMC). If you must edit the registry directly, back it up first. For more information, see "Related Topics".
Comment
• Some operations can view or configure the registry entries of the local or remote computer, while others only allow the configuration of the registry settings of the local computer. In addition, the use of reg to configure the remote computer's registry limits the parameters that can be used in certain operations. Check the syntax and parameters of each operation to confirm whether they can be used on the remote computer. |
|