| |

VerySource

 Forgot password?
 Register
Search
View: 1190|Reply: 2

Encyclopedia of registry command line operations! The vb operation is troublesome. I will save the root. Use it when you

[Copy link]

1

Threads

11

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-12-14 12:30:01
| Show all posts |Read mode
REG command
Reg
Add, change, import, export and other operations on the registry subkey information and the value in the registry key value.

The reg command includes:

reg add

reg compare

reg copy

reg delete

reg export

reg import

reg load

reg query

reg restore

reg save

reg unload

reg add
Add the new subkey or key to the registry.

Grammar
reg add KeyName [{/v ValueName | /ve}] [/t DataType] [/s Separator] [/d Data] [/f]

Parameter
KeyName

Specify the full path of the subkey or item to be added. 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.

/v ValueName

Specify the name of the registry key to be added to the specified subkey.

/ve

Specifies that the registry key added to the registry is a null value.

/t Type

Specifies the type of registry key. Type must be one of the following types:

REG_SZ

REG_MULTI_SZ

REG_DWORD_BIG_ENDIAN

REG_DWORD

REG_BINARY

REG_DWORD_LITTLE_ENDIAN

REG_LINK

REG_FULL_RESOURCE_DESCRIPTOR

REG_EXPAND_SZ

/s Separator

When the REG_MULTI_SZ data type is specified and multiple items need to be listed, specify the character used to separate multiple instances of data. If not specified, the default separator "\0" will be used.

/d Data

Specify the data for the new registry key.

/f

Add registry keys without asking for confirmation.

/?

Display the help of reg add at the command prompt.

Comment
• This operation cannot add subtrees. This version of Reg does not need to ask for confirmation when adding children.
  
• The following table lists the return values ​​of the reg add operation.

  
Value Description
0
Success
  
1
Fail
  
  
• For the REG_EXPAND_SZ item type, use the caret (^) with "%" in the /d parameter.
  

Example
To add the HKLM\Software\MyCo entry on the remote computer ABC, type:

REG ADD\\ABC\HKLM\Software\MyCo

To add a registry key to HKLM\Software\MyCo, the options are Value Name: Data; Type: REG_BINARY; Value Data: fe340ead; please type:

REG ADD HKLM\Software\MyCo /v Data /t REG_BINARY /d fe340ead

To add a multi-value registry key to HKLM\Software\MyCo, the options are value name: MRU; data type: REG_MULTI_SZ; value data: fax\0mail\0\0; please type:

REG ADD HKLM\Software\MyCo /v MRU /t REG_MULTI_SZ /d fax\0mail\0\0

To add an extended registry key to HKLM\Software\MyCo, the option is value name: Path; data type: REG_EXPAND_SZ; value data: %systemroot%; please type:

REG ADD HKLM\Software\MyCo /v Path /t REG_EXPAND_SZ /d ^%systemroot^%

reg compare
Compare the specified registry subkey or key.

Grammar
reg compare KeyName1 KeyName2 [{/v ValueName | /ve}] [{/oa | /od | /os | on}] [/s]

Parameter
KeyName1

Specify the full path of the first child item to compare. 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.

KeyName2

Specify the full path of the second subkey to be compared. 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. Specifying only the computer name in KeyName2 will cause the operation to use the path to the subkey specified in KeyName1. 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.


REG command

/v ValueName

Specifies the name of the value under the subkey to be compared.

/ve

Specifies to compare only items whose value name is null.

[{/oa | /od | /os | on}]

Specify how to display the results of the comparison operation. The default setting is /od. The following table lists each option.

  
Value Description
/oa
Specify to display all different points and matching points. By default, only the differences are listed.
  
/od
Specifies that only differences are displayed. This is the default operation.
  
/os
Specifies that only matching points are displayed. By default, only the differences are listed.
  
/on
Specifies that nothing is displayed. By default, only the differences are listed.
  

/s

Compare all children and items recursively.

/?

Display the help of reg compare at the command prompt.

Comment
• The following table lists the return values ​​of the reg compare operation.

  
Value Description
0
The comparison is successful and the result is the same.
  
1
The comparison fails.
  
2
Compare success and find differences.
  
  
• The following table lists the symbols displayed in the results.

  
Symbol Description
=
KeyName1 data is equal to KeyName2 data
  
<
KeyName1 data is less than KeyName2 data
  
>
KeyName1 data is greater than KeyName2 data
  
  

Example
To compare all the values ​​under the MyApp key with all the values ​​under the SaveMyApp key, type:

REG COMPARE HKLM\Software\MyCo\MyApp HKLM\Software\MyCo\SaveMyApp

To compare the value of Version under MyCo with the value of Version under MyCo1, type:

REG COMPARE HKLM\Software\MyCo HKLM\Software\MyCo1 /v Version

To compare all the subkeys and values ​​under HKLM\Software\MyCo on the computer ZODIAC with all the subkeys and values ​​under HKLM\Software\MyCo on the current computer, type:

REG COMPARE\\ZODIAC\HKLM\Software\MyCo\\. /s
Reply

Use magic Report

1

Threads

11

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-12-14 12:45:01
| Show all posts
reg copy
Copy a registry key to a specified location on a local or remote computer.

Grammar
reg copy KeyName1 KeyName2 [/s] [/f]

Parameter
KeyName1

Specify the full path of the child item to be copied. 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.

KeyName2

Specify the full path of the subproject. 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.

/s

Copy all sub-items and items under the specified sub-item.

/f

Copy the sub-items without asking for confirmation.

/?

Display the help of reg copy at the command prompt.

Comment
&#8226; Reg does not ask for confirmation when copying subitems.
  
&#8226; The following table lists the return value of the reg copy operation.

  
Value Description
0
Success
  
1
Fail
  
  

Example
To copy all subkeys and values ​​under the MyApp key to the SaveMyApp key, type:

REG COPY HKLM\Software\MyCo\MyApp HKLM\Software\MyCo\SaveMyApp /s

To copy all the values ​​under the MyCo key on the computer ZODIAC to the MyCo1 key on the current computer, type:

REG COPY\\ZODIAC\HKLM\Software\MyCo HKLM\Software\MyCo1

reg delete
Delete the subkey or key from the registry.

Grammar
Reg delete KeyName [{/v ValueName | /ve | /va}] [/f]

Parameter
KeyName

Specify the full path of the subkey or item to be deleted. 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.

/v ValueName

Delete specific items under sub-items. If no item is specified, all items and subitems under the subkey will be deleted.




REG command

/ve

Specify that only items with empty values ​​can be deleted.

/va

Delete all items under the specified subkey. Use this parameter to delete the sub-items under the specified sub-item.

/f

Delete existing registry subkeys or entries without asking for confirmation.

/?

Display the help of reg delete at the command prompt.

Comment
&#8226; The following table lists the return value of the reg delete operation.

  
Value Description
0
Success
  
1
Fail
  
  

Example
To delete the registry key Timeout and all its subkeys and values, type:

REG DELETE HKLM\Software\MyCo\MyApp\Timeout

To delete the registry value MTU under HKLM\Software\MyCo on the computer ZODIAC, type:

REG DELETE\\ZODIAC\HKLM\Software\MyCo /v MTU

reg export
Copy the specified subkeys, items, and values ​​of the local computer to a file for transmission to other servers.

Grammar
Reg export KeyName FileName [/y]

Parameter
KeyName

Specify the full path of the child. The Export operation can only work 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 created during the operation. The file must have a .reg extension.

/y

No confirmation is required to overwrite any existing file named FileName.

/?

Display the help of reg export at the command prompt.

Comment
&#8226; The following table lists the return value of the reg export operation.

  
Value Description
0
Success
  
1
Fail
  
  

Example
To export the contents of all subkeys and values ​​of the MyApp item to the file AppBkUp.reg, type:

reg export HKLM\Software\MyCo\MyApp AppBkUp.reg

reg import
Copy the contents of the file containing the exported registry subkeys, keys, and values ​​to the registry of the local computer.

Grammar
Reg import FileName

Parameter
FileName

Specify the name and path of the file whose contents will be copied to the local computer registry. This file must be created in advance using reg export.

/?

Display the help of reg import at the command prompt.

Comment
&#8226; The following table lists the return value of the reg import operation.

  
Value Description
0
Success
  
1
Fail
  
  

Example
To import registry keys from a file named AppBkUp.reg, type:

reg import AppBkUp.reg

reg load
Write the saved subkeys and keys back to different subkeys of the registry. Use with temporary files for troubleshooting or editing registry keys.

Grammar
reg load KeyName FileName

Parameter
KeyName

Specify the full path of the child item to be loaded. 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 file to be loaded. The file must be created in advance using the reg save operation with .hiv as the extension.

/?

Display the help of reg load at the command prompt.

Comment
&#8226; The following table lists the return value of the reg load operation.

  
Value Description
0
Success
  
1
Fail
  
  

Example
To load a file named TempHive.hiv into the HKLM\TempHive key, type:

REG LOAD HKLM\TempHive TempHive.hiv

reg quer#
Returns a list of subkeys and keys at the next level under the subkey specified in the registry.

Grammar
reg query KeyName [{/v ValueName | /ve}] [/s] [/se Separator] [/f Data] [{/k | /d}] [/c] [/e] [/t Type] [ /z]

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.

/v ValueName

Specifies the name of the registry value to be queried. If omitted, all value names of KeyName are returned. If the /f option is also used, the ValueName of this parameter is optional.
Reply

Use magic Report

1

Threads

11

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-12-14 13:00:01
| Show all posts
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
&#8226; 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
&#8226; 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.
  
&#8226; 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
&#8226; The following table lists the return value of the reg save operation.

  
Value Description
0
Success
  
1
Fail
  
  
&#8226; 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
&#8226; 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

&#8226; 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
&#8226; 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.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list