How to Edit the Windows Registry in the Command Prompt (2024)

The Registry Editor is the first thing Windows users bring up when it comes to editing the Windows Registry. However, if you don't want to deal with a distracting GUI and too many clicks, there's a simpler-looking tool you can use: the Command Prompt.

Although using it takes a little more know-how than the Registry Editor, our guide should be able to get you started.

How to View the List of Registry Commands in Command Prompt

How to Edit the Windows Registry in the Command Prompt (1)

There aren't a lot of commands when it comes to editing the registry using Command Line. To view them all, open Command Prompt as an administrator and run the below command in Command Prompt:

reg /? 

Command Prompt will then list the commands, such as reg add, reg delete, reg copy, and reg save.

How to Edit the Windows Registry in the Command Prompt (2)

If you want to see more information about them, just add the /? switch at the end of the command. For, example, if you want to find out what the reg add command does, you'd enter the below command:

reg add /? 

After you run it, you'll get all the details on what it does and how to use it.

How to Edit the Windows Registry in the Command Prompt (3)

If you're finding it hard the commands out on your own, don't worry. We will simplify it for you and show you how to get started using them.

Add and Delete Keys in the Windows Registry

To add a key to the registry using Command Prompt, you need to use the reg add command while specifying the path to the new key and whether you want to force the operation with the /f switch (this will bypass the need for the confirmation prompt).

As always, when it comes to editing the Windows Registry, we recommend that the first thing you do is create a system restore point on Windows.

Here's an example:

REG Add HKLM\SOFTWARE\MyNewKey /f 

In the above command, we're adding the MyNewKey subkey to the KHLM/Software key. If you go to the Registry Editor and expand that key, you'll be able to see the MyNewKey subkey within it.

Deleting the key is simple as well, as you just need to replace add with delete in the above example. Here's how:

reg delete HKLM\SOFTWARE\MyNewKey /f 

Now the MySubKey key will disappear in the Registry Editor.

How to Add, Modify, and Delete Values in the Windows Registry

How to Edit the Windows Registry in the Command Prompt (4)

To add or modify a value key in the registry using Command Prompt, you'll still use the reg add command like above. However, this time, you'll also have to specify the following parameters: value (/v), value type (/t), and value data (/d). Here's an example of what the command would like:

reg add HKLM\SOFTWARE\MyNewKey /v MyValue /t REG_DWORD /d "1" /f 

Once you run the command, you will be able to find the value in the Registry Editor. And if the key doesn't exist, Command Prompt will create it.

The Windows Registry uses several value types, and here's a table of the common ones:

Value Type

Description

REG_NONE

No value type

REG_SZ

String value

REG_MULTI_SZ

Multi-string value

REG_EXPAND_SZ

Expanded string value

REG_DWORD

32-bit DWORD value

REG_QWORD

64-bit QWORD value

REG_BINARY

Binary value

To delete the value, you just need to use the reg delete command while specifying the path to the key, and the name of the value. Here's an example of deleting the value we created earlier:

reg delete HKLM\SOFTWARE\MyNewKey /v MyValue /f 

After running the above command successfully, the value should disappear from the Registry Editor.

How to Copy Registry Entries From One Key to Another

How to Edit the Windows Registry in the Command Prompt (5)

Sometimes, you might want to copy the values from one key to another in the registry. This is as easy as using the reg copy command while specifying the key you're copying them from and the one you're copying them to (keep in mind that both keys have to already exist before you run the command). Here's an example:

reg copy HKLM\SOFTWARE\MyNewKey1 HKLM\SOFTWARE\MyNewKey2 /s 

The /s switch at the end tells Command Prompt that it should copy every subkey and value in the first key (MyNewKey1) into the second one (MyNewKey2).

Unfortunately, there's no way to copy specific values from one key to another. You'll have to use the Registry Editor for that.

How to Import Registry Entries

How to Edit the Windows Registry in the Command Prompt (6)

If you have created a Windows Registry file or downloaded it elsewhere, you can import it into the registry using the reg import command. All you need to do is specify the path to the registry file and Command Prompt will do the rest. Here's an example:

reg import C:\Users\CHIFUNDO\Desktop\MyRegFile.reg 

Once you run that command, the contents of the reg file will be merged with the registry.

How to Export Registry Entries

How to Edit the Windows Registry in the Command Prompt (7)

You can export a key in the registry using the reg export command while specifying the path of the key you want to export and the file you want to create. This comes in handy when you need to back up certain keys and values to restore them elsewhere. Here's an example:

reg export"HKLM\SOFTWARE\MyNewKey" D:\Reg_Backup\CHIFUNDO\Desktop\MyRegFile.reg 

After you run the command successfully, check the location you entered, and you'll find the key and its associated subkeys and values have been exported successfully. In our case, it will create a file called MyRegFile.reg and save it on the desktop.

You can also export a specific value using the reg query command and include the key, value, and path to the registry file you want to export the value to. Here's an example.

reg query HKLM\SOFTWARE\MyNewKey /v MyValue > C:\Users\CHIFUNDO\Desktop\MyRegFile.reg 

The resulting registry file will only contain the key and the specific value you exported.

How to Save Registry Entries

How to Edit the Windows Registry in the Command Prompt (8)

If you already have a registry file or any other text file, you can add keys to it using Command Prompt and the reg save command, which will overwrite the file with the new information. You just need to specify the name of the key and the registry file you want to save it to. Here's an example:

reg save HKLM\SOFTWARE\MyNewKey2 C:\Users\CHIFUNDO\Desktop\MyRegFile.hiv /y 

The /y switch at the end of the command above overwrites the file you're saving the key to without bringing up a prompt. When you open the file, you won't be able to read the contents since it will be saved as a binary file.

How to Restore Registry Entries

How to Edit the Windows Registry in the Command Prompt (9)

So, let's say something has happened to the keys and values within the MyNewKey2 we saved in the previous section, you can use the backup file you created to restore it. You'll need to use the reg restore command. Here's how to run it:

reg restore HKLM\SOFTWARE\MyNewKey2 C:\Users\CHIFUNDO\Desktop\MyRegFile.hiv 

Now the MyNewKey2 key should return to the state it was in when you made the backup.

Tweak the Registry Without the Registry Editor

While Command Prompt can't do everything the Registry Editor does, it does offer a quick way to edit the registry without opening the aforementioned tool. While using Command Prompt to tweak the registry is quite advanced, even if you're the average user, you should be able to get by if you follow along closely.

Just don't forget to do what we mentioned earlier to avoid permanently ruining your Windows computer and create a system restore point first

How to Edit the Windows Registry in the Command Prompt (2024)
Top Articles
13 Awesome Tricks for Negotiating Credit Card Debt
How I Ditched Debt: Smart Solutions for ‘Stupidest Decision’ - NerdWallet
The Largest Banks - ​​How to Transfer Money With Only Card Number and CVV (2024)
Satyaprem Ki Katha review: Kartik Aaryan, Kiara Advani shine in this pure love story on a sensitive subject
Online Reading Resources for Students & Teachers | Raz-Kids
Workday Latech Edu
Nfr Daysheet
Craigslist Motorcycles Jacksonville Florida
라이키 유출
Overzicht reviews voor 2Cheap.nl
FIX: Spacebar, Enter, or Backspace Not Working
Sand Castle Parents Guide
Daily Voice Tarrytown
Sport-News heute – Schweiz & International | aktuell im Ticker
Locate At&T Store Near Me
R Cwbt
Yard Goats Score
2024 INFINITI Q50 Specs, Trims, Dimensions & Prices
Kashchey Vodka
Sea To Dallas Google Flights
How Taraswrld Leaks Exposed the Dark Side of TikTok Fame
Finding Safety Data Sheets
Sound Of Freedom Showtimes Near Movie Tavern Brookfield Square
Geico Car Insurance Review 2024
Weather Underground Durham
Korg Forums :: View topic
Top Songs On Octane 2022
The value of R in SI units is _____?
60 Second Burger Run Unblocked
Colin Donnell Lpsg
Puretalkusa.com/Amac
EST to IST Converter - Time Zone Tool
Petsmart Distribution Center Jobs
Bee And Willow Bar Cart
Car Crash On 5 Freeway Today
Asian Grocery Williamsburg Va
Craigslist Mount Pocono
The Complete Guide To The Infamous "imskirby Incident"
Wrigley Rooftops Promo Code
Craigslist Freeport Illinois
Wasmo Link Telegram
Mugshots Journal Star
Cl Bellingham
Holzer Athena Portal
Noga Funeral Home Obituaries
Mcoc Black Panther
Craigslist Pet Phoenix
1Tamilmv.kids
Runescape Death Guard
Cryptoquote Solver For Today
Ihop Deliver
Latest Posts
Article information

Author: Terence Hammes MD

Last Updated:

Views: 6267

Rating: 4.9 / 5 (69 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Terence Hammes MD

Birthday: 1992-04-11

Address: Suite 408 9446 Mercy Mews, West Roxie, CT 04904

Phone: +50312511349175

Job: Product Consulting Liaison

Hobby: Jogging, Motor sports, Nordic skating, Jigsaw puzzles, Bird watching, Nordic skating, Sculpting

Introduction: My name is Terence Hammes MD, I am a inexpensive, energetic, jolly, faithful, cheerful, proud, rich person who loves writing and wants to share my knowledge and understanding with you.