How to Edit Windows Registry Via Command Prompt

How to Edit Windows Registry Via Command Prompt

550Views
How-To

Windows Registry is a database of information concerning various configurations of PC settings and applications for systems running on Microsoft’s Windows operating system. Though not every app needs to be run on a configuration database stored on Windows registries (some store the configuration data in XML files or a separate executable file), the registries play a vital role in the proper functioning of your Windows PC.

Windows offer users an option to edit these registries in case they want to change the configuration settings for an application or program on their computer. Let’s learn more about how you can use these registries and edit them as per your choice:

How Do Windows Registries Work?

The information stored in Windows registries is organized on three different registry levels:

  • Registry Hives:

These are a collection of keys, subkeys, and registry values, represented by folders. These folders are categorized into subfolders depending on the type of data values they hold.

  • Registry Keys:

These are those subfolders that makeup Registry Hives. These are considered to be the standard unit of organization in windows registries. These are like the folders in the Windows File Explorer which holds different types of files on your computer. Similarly, Registry Keys holds the registry values.

  • Registry Values:

These are the instructions or information of configurations and system settings. Each registry value holds instruction for particular system settings, application, or associated configurations.

Read More: How to Add, Modify, & Delete Registry Keys & Values via Regedit

How to Edit Windows Registry Using Command Prompt?

In case, you need to tweak the Windows Registry; you can navigate through the process via the command prompt on a Windows 10 PC. All you need to do is follow the procedure below:

Opening the Command Prompt

command prompt

First, Head to the Windows Search Bar.

Then, type cmd in the search bar. Search results will show Command Prompt as the top result.

Right-click on the Command Prompt option and click on Run as Administrator.

This will open up the command prompt on your Windows PC in admin mode.

Read More: How to Change Command Prompt Background

Operation Types to Edit Registries

Step 1: Run the following command to get all the list of operations you can perform to edit Windows Registry.

REG /?

Operation Types define what changes you need to make in a Windows Registry, for example, adding a subkey via the Add operation type.

admin command prompt

Step 2: The command prompt will display all the operations along with the Return Code for each of those commands. Return Codes determine whether the command execution failed or succeeded.

Note: Microsoft provides the content in the tables below

Operations Task
Add Adds a new entry to the registry
Compare Compares two or more registry subkeys or entries.
Copy Copies a registry entry to a specified location on a local or remote machine.
Load Writes saved subkeys and entries into a different subkey in the registry. This is intended to be used with temp files that are used for troubleshooting or editing registry entries.
Restore Writes saved subkeys and entries back to the registry.
Query Returns a list of the next tier of subkeys and entries that are located under a specified subkey in the registry.
Import Copies the contents of a file that contains exported registry subkeys, entries, and values into the registry of the local computer.
Export Copies the specified subkeys, entries, and values of the local computer into a file for transfer to other servers.
Save Saves a copy of specified subkeys, entries, and values of the registry in a specified file.
Delete Deletes a subkey or entries.
Unload Removes a section of the registry that was loaded using the REG LOAD  operation.

Source: Microsoft

Return Codes Results
0 Success
1 Fail

Source: Microsoft

Finding Syntax

To find a syntax, all you need to do is add the Operation Name in between the previous REG command. Just like this –

REG <Operation>

This particular step will produce all the information you need about that particular operation, including all the parameters and syntax. Let’s find the syntax by taking the example of the Add operation type.

Executing An Edit Task Using Operation Types: Adding a Subkey or Entry

Step 1: You can add a subkey to the registry via the Add operation. To begin with an edit, you need to put the operation type in between the REG command.

Since we’re using the Add operation type, you need to type the command –

REG <Add>

Step 2: The Syntax is right there in the second line of the prompt – 

REG ADD <KeyName> [{/v ValueName | /ve}] [/t DataType] [/s Separator] [/d Data] [/f]

windows command prompt

Here –

  • <KeyName> specifies the path of the subkey. Usually, the root keys used as a path are designated by HKLM or HKU.
  • /v ValueName specifies the name of the subkey.

The other syntax parameters are not needed in case of Add operation type.

Step 3: Assuming your subkey name is – MySubkey; the command that’ll go with the operation type will be –

REG ADD HKLM\Software\MySubkey

Deleting a Subkey

Step 1: The syntax of Delete operation is –

REG DELETE <KeyName> [{/v ValueName | /ve | /va}] [/f]

reg deleteStep 2: Assuming you need to delete the same subkey you created in the previous step; the command will be –

REG DELETE HKLM\Software\MySubkey

Step 3: Type YES to confirm the delete command.

Step 4: Press Enter.

These are just two operations. Every operation requires a different syntax which you now know how to figure out, and each carries out different tasks. You can visit this document published by Microsoft to learn more about Registry Operation Types, Syntax, and Parameters.

Read More: How to Fix Registry Errors in Windows 10

Disclaimer: Why Refrain from Tweaking  Windows Registries?

Any change you make in Control Panel Settings, system associations, software or app installations, etc. are automatically reflected in the Windows Registry. In case, you try to edit the Windows Registries manually; you may end up corrupting any of these settings, configurations, and system policies. This can lead to several computer problems, such as system crashes, corrupt applications, unbootable drives, problems in saved files and system folders.

Hence it is recommended that you do not try to tweak the Windows Registry unless you are entirely aware of all the syntax and parameters or you are not in dire need to do it.

You May Also Like

Why Fixing Registry Issues Is Important

How to Change Windows Password Without Knowing Current Password

What Do You Think?
Responses

2 COMMENTS

  • pamela
    great read and learn helped

    1 month ago Reply
    • Abhishek Sharma
      Thanks, Pamela. We’re glad you liked our content. You can follow us on our social media handles to get regular updates on the latest blog posts.

      3 weeks ago Reply

Leave a Reply

POPULAR ARTICLES


AS SEEN ON