How to edit Registry from Command Prompt on Windows 11 and 10 (2024)

How to edit Registry from Command Prompt on Windows 11 and 10 (1)

Jump To:

  • Basic commands
  • Add and delete
  • Copy
  • Export and import
  • Save and restore

On Windows 11 (and 10), the Registry is a critical hierarchical database that stores low-level settings that help the operating system and applications to work correctly.

You typically use the "Registry Editor" to modify this database when fixing an issue or configuring or turning off a specific feature. However, you probably may not know that the operating system includes "Reg.exe," a command-line tool that allows you to edit the Registry through the Command Prompt.

"Reg.exe" comes built into Windows 11 and 10, including the same functionalities available in the Registry application. You can edit entries faster, as you don't have to browse the confusing tree database manually. And you get the flexibility of being able to implement tweaks using scripts.

In this how-to guide, I will walk you through the steps to get started using the Microsoft "Reg.exe" tool to edit the Registry using Command Prompt.

Important: If you plan to use these commands on your computer, understand that modifying the Registry is risky and can cause irreversible damage to your installation if you don't do it correctly. It's recommended to make a full backup of your computer before proceeding.

How to edit the Registry from Command Prompt

To start the Reg tool, you first need to start Command Prompt as an administrator using these steps:

  1. Open Start.
  2. Search for Command Prompt, right-click the result, and select Run as administrator.
  3. Type the following command to access the help menu and press Enter: reg /?
  4. Confirm the options available with the tool, including:
  • REG Query
  • REG Add
  • REG Delete
  • REG Copy
  • REG Save
  • REG Load
  • REG Unload
  • REG Restore
  • REG Compare
  • REG Export
  • REG Import
  • REG Flags

You can also use "REG" followed by the operation type and "/?" to get more help. For example, REG QUERY /? or REG ADD /?.

Get the Windows Central Newsletter

All the latest news, reviews, and guides for Windows and Xbox diehards.

Using this tool, you will also get two return codes, including "0," meaning that the operation was completed successfully, and "1," indicating that the operation failed. However, you won't get any return codes using the "Compare" option.

While there is a long list of possible combinations, below, I will only highlight the most useful commands to get started using Reg with Command Prompt.

How to add and delete registry entries

Syntax

  • Add: REG ADD KeyName [{/v ValueName | /ve}] [/t Type] [/f]
  • Delete: REG DELETE KeyName [{/v ValueName | /ve | /va}] [/f]

Command description

  • KeyName: Defines the path to the subkey or entry. Valid registry key shortcuts include HKLM, HKCU, HKCR, HKU, and HKCC. If you want to edit the registry on a remote computer, you can only use HKLM and HKU shortcuts.
  • /v ValueName: Specifies the name for the registry key to be added or deleted.
  • /ve: Defines if you're adding or deleting an entry with a null value.
  • /f: Adds or deletes registry content without prompting for confirmation.
  • /s Separator: Defines the character to separate multiple instances of data when the REG_MULTI_SZ data type is specified and you need to add more than one entry. The default separator is \0 if it is not specified.
  • /d Data: Specifies the data for the new entry in the registry.
  • /t Type: Specifies the type of registry entries. Here's the list of valid types: REG_SZ, REG_MULTI_SZ, REG_DWORD_BIG_ENDIAN, REG_DWORD, REG_BINARY, REG_DWORD_LITTLE_ENDIAN, REG_LINK, REG_FULL_RESOURCE_DESCRIPTOR, and REG_EXPAND_SZ.

REG ADD examples

To add a subkey named MySubkey under HKEY_LOCAL_MACHINE\Software, use the following example: REG ADD HKLM\Software\MySubkey

How to edit Registry from Command Prompt on Windows 11 and 10 (3)

To add a new DWORD (32-bit) value entry named "AppInfo" with the value of "1," use the following example: REG ADD HKLM\Software\MySubkey /v AppInfo /t REG_DWORD /d 1

To add a new DWORD (32-bit) value entry named "AppInfo" with the value of "1" on a remote computer, use the following example: REG ADD \\ComputerName\HKLM\Software\MySubkey /v AppInfo /t REG_DWORD /d 1

To add a new Binary Value entry named "Data" with data of "fe340ead," use the following example: REG ADD HKLM\Software\MySubkey /v Data /t REG_BINARY /d fe340ead

To add a registry entry with multiple values to "MySubkey" with a value name of MRU of type "REG_MULTI_SZ" and data of "fax\0mail\2\1," use the following example: REG ADD HKLM\Software\MySubkey /v MRU /t REG_MULTI_SZ /d fax\0mail\2\1

How to edit Registry from Command Prompt on Windows 11 and 10 (4)

To add an expanded registry entry to "MySubkey" with a value name of "Path" of type "REG_EXPAND_SZ" and data of "%systemroot%," use the following example: REG ADD HKLM\Software\MySubkey /v Path /t REG_EXPAND_SZ /d ^%systemroot^%

REG DELETE examples

To delete the subkey named "MySubkey," use the following example: REG DELETE HKLM\Software\MySubkey /f

How to edit Registry from Command Prompt on Windows 11 and 10 (5)

To delete the subkey named "MySubkey" on a remote computer, use the following example: REG DELETE \\ComputerName\HKLM\Software\MySubkey /f

To delete the registry entry named "AppInfo" within the "MySubkey" subkey, use the following example: REG DELETE HKLM\Software\MySubkey /v AppInfo /f

To delete only the registry entries that have no value inside the subkey named MySubkey, use the following example: REG DELETE HKLM\Software\MySubkey /ve

To delete all the registry entries from the "MySubkey" subkey, use the following example: REG DELETE HKLM\Software\MySubkey /va

How to copy registry entries

Syntax

  • Copy: REG COPY KeyName1 KeyName2 [/s] [/f]

Command description

  • KeyName1: Defines the path to the subkey you want to copy. Valid registry key shortcuts include HKLM, HKCU, HKCR, HKU, and HKCC. If you're trying to copy the registry on a remote computer, you can only use HKLM and HKU shortcuts.
  • KeyName2: Defines the path to the subkey destination. Valid registry key shortcuts include HKLM, HKCU, HKCR, HKU, and HKCC. If you're trying to copy the registry on a remote computer, you can only use HKLM and HKU shortcuts.
  • /s: Copies all subkeys and entries of a particular subkey.
  • /f: Executes the copy command without prompting for confirmation.

REG COPY examples

To copy all subkeys and values under the key "MySubkey1" to the key "MySubkey2," use the following example: REG COPY HKLM\Software\MySubkey1 HKLM\Software\MySubkey2 /s

How to edit Registry from Command Prompt on Windows 11 and 10 (6)

To copy all values under the subkey "MySubkey1" from a remote computer to the subkey "MySubkey2" on the new computer, use the following example: REG COPY \\ComputerName\HKLM\Software\MySubkey1 HKLM\Software\MySubkey2

How to export and import registry entries

Syntax

  • Export: REG EXPORT KeyName FileName [/y]
  • Import: REG IMPORT FileName

Command description

  • KeyName: Defines the path to the subkey or entry. Valid registry key shortcuts include HKLM, HKCU, HKCR, HKU, and HKCC.
  • FileName: Specifies the name and path of the .reg file to be exported or imported.
  • /y: Overwrites the registry content without prompting for confirmation.

REG EXPORT examples

To export all the content within the subkey "MySubkey," use the following example: REG EXPORT HKLM\Software\MySubkey C:\RegKeyBackup.reg

How to edit Registry from Command Prompt on Windows 11 and 10 (7)

To export and overwrite any existing file, use the following example: REG EXPORT HKLM\Software\MySubkey C:\RegKeyBackup.reg /y

REG IMPORT examples

To import all the content, including subkeys, entries, and values within the subkey named "MySubkey," use the following example: REG IMPORT C:\RegKeyBackup.reg

How to save and restore registry entries

Syntax

  • Save: REG SAVE KeyName FileName [/y]
  • Restore: REG RESTORE KeyName FileName

Command description

  • KeyName: Defines the path to the subkey or entry. Valid registry key shortcuts include HKLM, HKCU, HKCR, HKU, and HKCC. If you're trying to edit the registry on a remote computer, you can only use HKLM and HKU shortcuts.
  • FileName: Specifies the name and path of the .hiv file to be saved or restored.
  • /y: Overwrites the registry content without prompting for confirmation.

REG SAVE examples

To save a copy of subkeys, entries, and values within the subkey named "MySubkey," use the following example: REG SAVE HKLM\Software\MySubkey C:\RegKeyBackup.hiv

How to edit Registry from Command Prompt on Windows 11 and 10 (8)

To save and overwrite any existing file, use the following example: REG SAVE HKLM\Software\MySubkey C:\RegKeyBackup.hiv /y

REG RESTORE examples

To restore all the content, including subkeys, entries, and values within the subkey named "MySubkey," use the following example: REG RESTORE HKLM\Software\MySubkey C:\RegKeyBackup.hiv

How to edit Registry from Command Prompt on Windows 11 and 10 (9)

Although you can always use the Registry Editor, you'll find that it's sometimes easier and faster to use the Reg command-line tool. However, you will still be editing the system's database, which can cause problems no matter the method.

When editing the Registry with commands, it's recommended to double-check your commands before executing, as you can make mistakes. For example, "REG ADD HKLM\Sofware\MySubkey" is different from "REG ADD HKLM\Software\MySubkey." A mistake like that might not do anything, or it could wreck your entire system.

If you're wondering, yes, there is a big difference between "Export" and "Save." The command EXPORT exports Registry content into a text format you can easily distribute to other computers as a ".reg" file. On the other hand, SAVE saves the Registry content into a hive file format (.hiv), which preserves ownership and additional important information. You should only use this command to restore entries to the same computer.

Also, while you can use many of these commands on a remote computer, "IMPORT" and "EXPORT" only work on a local computer (not over the network).

These instructions are more focused on Windows 11 and 10, but since the Reg tool has been part of the operating system for a long time, you can refer to these steps even in older versions, such as Windows 8.1 and 7.

More resources

For more helpful articles, coverage, and answers to common questions about Windows 10 and Windows 11, visit the following resources:

  • Windows 11 on Windows Central — All you need to know
  • Windows 10 on Windows Central — All you need to know
How to edit Registry from Command Prompt on Windows 11 and 10 (10)

Mauro Huculak

Mauro Huculak has been a Windows How-To Expert contributor for WindowsCentral.com for nearly a decade and has over 15 years of experience writing comprehensive guides. He also has an IT background and has achieved different professional certifications from Microsoft, Cisco, VMware, and CompTIA. He has been recognized as a Microsoft MVP for many years.

How to edit Registry from Command Prompt on Windows 11 and 10 (2024)
Top Articles
Jak wypłacić kryptowalutę z mojego portfela Giełdy Crypto.com (Na: Zewnętrzny adres portfela) | Centrum Wsparcia Crypto.com
How Much Does TikTok Pay + How to Go Viral on TikTok
Great Clips Mount Airy Nc
Foxy Roxxie Coomer
123 Movies Black Adam
Best Transmission Service Margate
Umn Pay Calendar
Craigslist Phoenix Cars By Owner Only
Rls Elizabeth Nj
Ohiohealth Esource Employee Login
Camstreams Download
Lima Crime Stoppers
Detroit Lions 50 50
Synq3 Reviews
Connexus Outage Map
Nj Scratch Off Remaining Prizes
Dirt Removal in Burnet, TX ~ Instant Upfront Pricing
Inter-Tech IM-2 Expander/SAMA IM01 Pro
Hollywood Bowl Section H
Best Mechanics Near You - Brake Masters Auto Repair Shops
We Discovered the Best Snow Cone Makers for Carnival-Worthy Desserts
Fsga Golf
Woodmont Place At Palmer Resident Portal
The EyeDoctors Optometrists, 1835 NW Topeka Blvd, Topeka, KS 66608, US - MapQuest
Rubber Ducks Akron Score
PCM.daily - Discussion Forum: Classique du Grand Duché
Litter Robot 3 RED SOLID LIGHT
Cain Toyota Vehicles
Crossword Help - Find Missing Letters & Solve Clues
Silky Jet Water Flosser
Celina Powell Lil Meech Video: A Controversial Encounter Shakes Social Media - Video Reddit Trend
15 Primewire Alternatives for Viewing Free Streams (2024)
Kirk Franklin Mother Debra Jones Age
The Fabelmans Showtimes Near Baton Rouge
Weather Underground Durham
Worthington Industries Red Jacket
Uno Fall 2023 Calendar
Planned re-opening of Interchange welcomed - but questions still remain
Learn4Good Job Posting
Ravens 24X7 Forum
Jambus - Definition, Beispiele, Merkmale, Wirkung
Gwen Stacy Rule 4
Nsu Occupational Therapy Prerequisites
Robot or human?
Acadis Portal Missouri
Raisya Crow on LinkedIn: Breckie Hill Shower Video viral Cucumber Leaks VIDEO Click to watch full…
Alston – Travel guide at Wikivoyage
Petra Gorski Obituary (2024)
Yale College Confidential 2027
Menu Forest Lake – The Grillium Restaurant
Kenwood M-918DAB-H Heim-Audio-Mikrosystem DAB, DAB+, FM 10 W Bluetooth von expert Technomarkt
Guidance | GreenStar™ 3 2630 Display
Latest Posts
Article information

Author: Greg O'Connell

Last Updated:

Views: 6368

Rating: 4.1 / 5 (62 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Greg O'Connell

Birthday: 1992-01-10

Address: Suite 517 2436 Jefferey Pass, Shanitaside, UT 27519

Phone: +2614651609714

Job: Education Developer

Hobby: Cooking, Gambling, Pottery, Shooting, Baseball, Singing, Snowboarding

Introduction: My name is Greg O'Connell, I am a delightful, colorful, talented, kind, lively, modern, tender person who loves writing and wants to share my knowledge and understanding with you.