Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the Reg command

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

Editor to share with you how to use the Reg command, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Edit the registry directly only if you have no choice. Registry Editor ignores standard security measures so that these settings degrade performance, damage the system, and even require users to reinstall Windows. You can use the program security in Control Panel or the Microsoft Management console (MMC) to change most registry settings. If you must edit the registry directly, back it up first. Use Reg to directly edit the registry of a local or remote computer. These changes may make the computer inoperable and require a reinstallation of the operating system. So instead of editing the registry directly, use the Control Panel or the Microsoft Management console (MMC) to change the registry as much as possible. Some actions allow you to view or configure registry keys for local or remote computers, while others only allow you to configure registry settings for local computers. At the same time, remote access to the registry may also restrict the parameters used for an operation. Check the syntax of each operation to verify that the operation can be used on a remote computer, and to verify the parameters that can be used in that case.

The reg command is provided by WindowsXP to add, change, and display registry subkey information and values in the registry key.

1 add reg adds a new subkey or key to the registry

Syntax: reg add KeyName [/ v EntryName | / ve] [/ t DataType] [/ s separator] [/ d value] [/ f]

Parameters.

KeyName

Specifies the full path to the child. For remote computers, include the computer name before the child path in\\ ComputerName\ PathToSubkey. Ignoring ComputerName causes the local computer to operate by default. Start the path with the appropriate subdirectory tree. Valid subdirectory trees are HKLM, HKCU, HKCR, HKU, and HKCC. There are only HKLM and HKU on the remote machine.

Value description

HKCR: HKEY_CLASSES_ROOT

HKCU: HKEY_CURRENT_USER

HKLM: HKEY_LOCAL_MACHINE

HKU: HKEY_USERS

HKCC: HKEY_CURRENT_CONFIG

/ v EntryName

Specifies the name of the item to add to the specified subkey.

/ ve

Specifies that the key added to the registry is null.

/ t DataType

Specifies the data type of the item value. DataType can be 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

Specifies the characters used to separate multiple data instances. Use this parameter when REG_MULTI_SZ is specified as a data type and multiple items need to be listed. If not specified, the default delimiter is "\ 0".

/ d value

Specifies the value of the new registry key.

/ f

Add subitems or items directly without asking for information.

/?

Displays help at the command prompt.

Notes

Subtrees cannot be added for this operation. This version of Reg does not require confirmation when adding subitems.

The following table lists the return values for the reg add operation. Value description

0 successful

1 failed

The name of the value to be added under the selected / v.

/ ve adds a blank value name to the registry key (default).

/ t RegKey data type

[REG_SZ | REG_MULTI_SZ | REG_EXPAND_SZ |

REG_DWORD | REG_QWORD | REG_BINARY | REG_NONE]

If omitted, REG_SZ is used.

/ s specifies a character to use as a delimiter in the REG_MULTI_SZ data string

If ignored, "\ 0" is used as the delimiter.

/ d data to be assigned to the added registry ValueName.

/ f forcibly overwrite the existing registry key without prompting.

Example

(in addition, cmd / k is to use the reg command at run)

The following example shows how to use the reg add command:

Cmd / k reg add "HKLM\ Software\ Microsoft\ Windows\ CurrentVersion\ explorer\ Advanced\ Folder\ Hidden\ SHOWALL" / v Checkedvalue / t reg_dword / d 1 / f (show hidden files and folders)

Cmd / k reg add "HKLM\ SOFTWARE\ Microsoft\ Windows\ CurrentVersion\ Run" / v systray / t REG_SZ / d "% SystemRoot%\ system32\ systray.exe" / f (boot volume control)

Cmd / k reg add "HKLM\ SOFTWARE\ Microsoft\ Windows NT\ CurrentVersion\ Winlogon" / v Shell / t REG_SZ / d "% SystemRoot%\ explorer.exe" / f (boot up the explorer shell)

Cmd / k reg add "HKLM\ SOFTWARE\ Microsoft\ Windows\ CurrentVersion\ Run" / v SoundMan / t REG_SZ / d "% SystemRoot%\ SOUNDMAN.exe" / f (boot up AC97 sound manager program)

Cmd / k reg add "HKLM\ SOFTWARE\ Microsoft\ Windows\ CurrentVersion\ App Paths\ IEXPLORE.EXE" / ve / d "% ProgramFiles%\ Internet Explorer\ IEXPLORE.EXE" / t REG_SZ / f

(the broadcast cannot be turned on in UC room)

Cmd / k reg add "HKLM\ SOFTWARE\ Microsoft\ Windows\ CurrentVersion\ App Paths\ MSCONFIG.EXE" / ve / d "% SystemRoot%\ PCHealth\ HelpCtr\ Binaries\ MSConfig.exe" / t REG_SZ / f

(running MSConfig prompts that the file cannot be found)

Cmd / k reg add "HKLM\ SOFTWARE\ Microsoft\ Windows\ CurrentVersion\ App Paths\ wmplayer.exe" / ve / d "% ProgramFiles%\ Windows Media Player\ wmplayer.exe" / t REG_SZ / f

(cannot call the repair of WMP player properly)

Cmd / k reg add "HKLM\ SOFTWARE\ Microsoft\ Windows\ CurrentVersion\ App Paths\ WORDPAD.EXE" / ve / d "% ProgramFiles%\ Windows NT\ Accessories\ WORDPAD.EXE" / t REG_SZ / f

(unable to call WordPad repair properly)

Cmd / k reg add "HKCU\ Software\ Microsoft\ Windows\ CurrentVersion\ Run" / v ctfmon.exe / t REG_SZ / d "% SystemRoot%\ system32\ ctfmon.exe" / f (boot input method program CTFMON)

Cmd / k reg add "HKCU\ ControlPanel\ Desktop" / v WaitToKIllAppTimeOut / t REG_SZ / d 10000 / f (accelerated shutdown of applications)

For example:

REG ADD\\ ABC\ HKLM\ Software\ MyCo

Add a registry key HKLM\ Software\ MyCo on the remote machine ABC

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

Add a value (name: Data, type: REG_BINARY, data: fe340ead)

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

Add a value (name: MRU, type: REG_MUTLI_SZ, data: fax\ 0mail\ 0\ 0)

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

Add a value (name: Path, type: REG_EXPAND_SZ, data:% systemroot%)

Note: use caret (^) in extended strings

Reg add HKLM\ System\ CurrentControlSet\ Services\ HTTP\ Parameters / v MaxConnections / t REG_DWORD / d 100000

Reg add HKLM\ SYSTEM\ CurrentControlSet\ services\ NlaSvc\ Parameters\ Internet / v EnableActiveProbing / t REG_DWORD / d 1

2 delete deletes keys or subkeys from the registry

Syntax: reg delete KeyName [{/ v EntryName | / ve | / va}] [/ f]

Parameters.

KeyName

Specifies the full path to the child. For remote computers, include the computer name before the child path in\\ ComputerName\ PathToSubkey. Ignoring ComputerName causes the local computer to operate by default. Start the path with the appropriate subdirectory tree. Valid subdirectory trees are HKLM, HKCU, HKCR, HKU, and HKCC.

/ v EntryName

Delete a specific item under a child. If no item is specified, all items and subitems under the subkey are deleted.

/ ve

Specifies that only items with null values can be deleted.

/ va

Deletes all items under the specified subkey. You cannot delete subitems under the specified subkey by using this parameter.

/ f

Delete an existing registry subkey or key without requesting confirmation.

/?

Displays help at the command prompt.

Notes

The following table lists the return values for the reg delete operation. Value description

0 successful

1 failed

Example

The following example shows how to use the reg delete command:

Cmd / k reg delete "HKLM\ SOFTWARE\ Microsoft\ Windows NT\ CurrentVersion\ Image File Execution Options\ taskmgr.exe" / f (the task manager in the taskbar is gray)

Cmd / k reg delete "HKLM\ SOFTWARE\ Microsoft\ Shared Tools\ MSConfig\ startupreg" / f (remove unchecked items from MSConfig startup)

Cmd / k reg delete "HKLM\ SOFTWARE\ Microsoft\ Windows NT\ CurrentVersion\ Image File Execution Options\ ctfmon.exe" / f (remove the image hijacking of CTFMON)

Cmd / k reg delete "HKCU\ Software\ Microsoft\ Windows\ CurrentVersion\ Explorer\ TrayNotify" / v IconStreams / f

Cmd / k reg delete "HKCU\ Software\ Microsoft\ Windows\ CurrentVersion\ Explorer\ TrayNotify" / v PastIconsStream / f (delete the history of the notification area)

3Query reg compare compares specified registry subkeys or keys

Syntax: reg compare KeyName1 KeyName2 [/ v EntryName | / ve] {[/ oa] | [/ od] | [/ os] | [on]} [/ s]

Parameters.

KeyName

Specifies the full path to the child. For remote computers, include the computer name before the child path in\\ ComputerName\ PathToSubkey. Ignoring ComputerName causes the local computer to operate by default. Start the path with the appropriate subdirectory tree. Valid subdirectory trees are HKLM, HKCU, HKCR, HKU, and HKCC. If you specify a remote computer, only the HKLM and HKU subdirectory trees can be used.

/ v EntryName

Compare specific items under subitems.

/ ve

Specifies that only items with no value can be compared.

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

Specifies how different and matching points are displayed. The default setting is / od. Value description

/ oa specifies that all different and matching points are displayed. By default, only differences are listed.

/ od specifies that only different points are displayed. This is the default action.

/ os specifies that only match points are displayed. By default, only differences are listed.

/ on specifies that nothing is displayed. By default, only differences are listed.

/ s Separator

Compare all children and items.

/?

Displays help at the command prompt.

Notes

The following table lists the return values for the reg compare operation. Value description

0 is more successful and the result is the same.

1 comparison failure.

2 more successful and find differences.

Example

The following example shows how to use the reg compare command:

Reg compare "hkcu\ software\ microsoft\ winmine"hkcu\ software\ microsoft\ winmine" / od / s

4 copy copy copies a registry key to a specified location on the local or remote computer

Syntax: reg copy KeyName1 KeyName2 [/ s] [/ f]

Parameters.

KeyName1

Specify the full path of the child to copy. For remote computers, include the computer name before the child path in\\ ComputerName\ PathToSubkey. Ignoring ComputerName causes the local computer to operate by default. Start the path with the appropriate subdirectory tree. Valid subdirectory trees are HKLM, HKCU, HKCR, HKU, and HKCC. If you specify a remote computer, only the HKLM and HKU subdirectory trees can be used.

KeyName2

Specifies the full path to the subitem destination. For remote computers, include the computer name before the child path in\\ ComputerName\ PathToSubkey. Ignoring ComputerName causes the local computer to operate by default. Start the path with the appropriate subdirectory tree. Valid subdirectory trees are HKLM, HKCU, HKCR, HKU, and HKCC. If you specify a remote computer, only the HKLM and HKU subdirectory trees can be used.

/ s

Copies all children and items under the specified subkey.

/ f

Copy the child directly without asking for confirmation.

/?

Displays help at the command prompt.

Notes

This version of Reg does not require confirmation when copying child items.

The following table lists the return values for the reg copy operation. Value description

0 successful

1 failed

Example

The following example shows how to use the reg copy command:

Reg copy "hkcu\ software\ microsoft\ winmine"hkcu\ software\ microsoft\ winminebk" / s / f

Reg copy "hkcu\ software\ microsoft\ winminebk"hkcu\ software\ microsoft\ winmine" / s

5 export creates a copy of the specified subitem, item, and value into a file so that it can be transferred to another server

Syntax: reg export KeyName FileName

Parameters.

KeyName

Specifies the full path to the child. Export operations can only work on the local computer. Start the path with the appropriate subdirectory tree. Valid subdirectory trees are HKLM, HKCU, HKCR, HKU, and HKCC.

FileName

Specify the name and path of the file to export. The file must have a .reg extension.

/?

Displays help at the command prompt.

Notes

The following table lists the return values for the reg export operation. Value description

0 successful

1 failed

Example

The following example shows how to use the reg export command:

Reg export "hkcu\ software\ microsoft\ winmine" c:\ data\ regbackups\ wmbkup.reg

6 Magi Reg import copies files containing exported registry subkeys, keys, and values to the registry of the local computer

Syntax: reg import FileName

Parameters.

FileName

Specifies the name and path of the file that will be copied to the local computer registry. The file must be created in advance using the reg export command.

/?

Displays help at the command prompt.

Notes

The following table lists the return values for the reg import operation. Value description

0 successful

1 failed

Example

The following example shows how to use the reg import command:

Reg import hkcu\ software\ microsoft\ winmine "c:\ data\ regbackups\ wmbkup.reg"

7 load Reg writes the saved subkeys and keys back to different subkeys in the registry

The purpose is to save to a temporary file that can be used to troubleshoot or edit registry keys.

Syntax: reg load KeyName FileName

Parameters.

KeyName

Specifies the full path to the child. For remote computers, include the computer name before the child path in\\ ComputerName\ PathToSubkey. Ignoring ComputerName causes the local computer to operate by default. Start the path with the appropriate subdirectory tree. Valid subdirectory tree is HKLM

8 minute reg query returns a list of keys under subkeys of the registry and subkeys of the next layer

Syntax: reg query KeyName [{/ v EntryName | / ve}] [/ s]

Parameters.

KeyName

Specifies the full path to the child. For remote computers, include the computer name before the child path in\\ ComputerName\ PathToSubkey. Ignoring ComputerName causes the local computer to operate by default. Start the path with the appropriate subdirectory tree. Valid subdirectory trees are HKLM, HKCU, HKCR, HKU, and HKCC. If you specify a remote computer, only HKLM and HKU subdirectory trees can be used.

/ v EntryName

Returns a specific item and its value. This parameter returns only items that are directly in the lower layer of the specified subitem. The item in the child under the current child will not be found. If EntryName is omitted, all items under the child are returned.

/ ve

Specifies that only items that are returned with null values are returned.

/ s

All children and items in each layer are returned. If you do not use this parameter, only the children and items of the next layer will be returned.

/?

Displays help at the command prompt.

Notes

The following table lists the return values for the reg query operation. Value description

0 successful

1 failed

Example

The following example shows how to use the reg query command:

Reg query "hklm\ system\ currentcontrolset\ control\ session manager" / v maxstacktracedepth

Reg query "hkcu\ software\ microsoft\ winmine" / s

9 reg restore writes the saved subkeys and keys back to the registry

Syntax: reg restore KeyName FileName

Parameters.

KeyName

Specifies the full path to the child. The Restore operation works only on the local computer. Start the path with the appropriate subdirectory tree. Valid subdirectory trees are HKLM, HKCU, HKCR, HKU, and HKCC.

FileName

Specifies the name and path of the file that will be written back to the registry. The file must be pre-created using a reg save operation with a .hiv extension.

/?

Displays help at the command prompt.

Notes

This action is used to overwrite the edited registry key. Before editing the registry key, use the reg save operation to save the parent child key. If editing fails, you can use this operation to restore subitems.

The following table lists the return values for the reg restore operation. Value description

0 successful

1 failed

Example

The following example shows how to use the reg restore command:

Reg restore "hkcu\ software\ microsoft\ winmine" wmbkup.hiv

10 minute reg save saves a copy of the specified subkey, key, and registry value to the specified file.

Grammar.

Reg save KeyName FileName

Parameters.

KeyName

Specifies the full path to the child. For remote computers, include the computer name before the child path in\\ ComputerName\ PathToSubkey. Ignoring ComputerName causes the local computer to operate by default. Start the path with the appropriate subdirectory tree. Valid subdirectory trees are HKLM, HKCU, HKCR, HKU, and HKCC.

FileName

Specify the name and path of the file you created. If no path is specified, the current path is used.

/?

Displays help at the command prompt.

Notes

The following table lists the return values for the reg save operation. Value description

0 successful

1 failed

Example

The following example shows how to use the reg save command:

Reg save "hkcu\ software\ microsoft\ winmine" wmbkup.hiv

11J Reg unload deletes part of the loaded registry using the reg load operation

Syntax: reg unload KeyName

Parameters.

KeyName

Specifies the full path to the child. For remote computers, include the computer name before the child path in\\ ComputerName\ PathToSubkey. Ignoring ComputerName causes the local computer to operate by default. Start the path with the appropriate subdirectory tree. Valid subdirectory trees are HKLM, HKCU, HKCR, HKU, and HKCC.

/?

Displays help at the command prompt.

Notes

The following table lists the return values for the reg unload operation. Value description

0 successful

1 failed

Example

The following example shows how to use the reg unload command:

Reg unload "hkcu\ software\ microsoft\ winminebk2"

The above is all the contents of this article "how to use Reg commands". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report