Home > Windows

How to Add and Delete Registry using Command Prompt

In this guide, we will show you the steps to add and delete registry values using Command Prompt. The registry editor beholds a slew of crucial data files and configuration settings related to various OS components as well as user and system apps. Just a random check and you may find many tech enthusiasts roaming the streets of this editor. Many of them are on the lookout for hacks that would add new and intriguing features to their context menu, File Explorer, Task Manager, and Start Menu, among others.

To carry out these tweaks, you just need to launch the Registry and make the desired changes to the DWord file, and in some instances, to the key and binary files as well. However, there could be a few negative consequences to it as well and unfortunately, I was on the receiving end recently when the Registry Editor itself got corrupted.

So there was no direct method to delete the newly created registry file or undo changes to that file. This is where I decided to do a little bit of research and found out that you could add and delete registry values using Command Prompt as well. So I decided to write up the findings in this guide and make you aware of the steps to carry out the said task. Follow along.

How to Add Registry using Command Prompt

Add Registry using Command Prompt

For this guide, we will be heading over to Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome. There we will create a new DWORD (32-bit) file named RendererCodeIntegrityEnabled and assign it 1 as its Value Data to enable it. And as you might have guessed, all of these will be carried out right from the Command Prompt itself. So let’s get started.

  1. Launch CMD as an administrator and refer to the below syntax.
  2. [The values in bold are variable and will change depending on the registry file you are dealing with. Whereas the non-bold characters are constant and will remain the same throughout].
    REG ADD "Address" /v ValueName /t RegistryType /d Data
  3. Here Address will be the registry file address, which in our case is
    Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome
  4. However, do note that you do not have to use the Computer keyword while entering this address in CMD.
  5. Moroever, instead of HKEY_LOCAL_MACHINE, you will have to use it short form HKLM.
  6. Likewise, use one of the following short forms, depending on the address: HKLM, HKCU, HKCR, HKU, and HKCC
  7. Next up is the ValueName. It is the name of the registry file that you are about to create. In our case, it is RendererCodeIntegrityEnabled
  8. After that, it is the RegistryType. It specifies the type of registry file that you would be creating [String, Binary, DWord, QWord, etc].
  9. In our case, we are creating a new DWord (32-bit) Value, so the Registry Type will be REG_DWORD.
  10. In this regard, here’s the list of all the values that you could refer to and use the one that corresponds to your registry file type.
    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
  11. Finally, the last variable in the syntax is Data. It determines the Value Data and is usually either 0 r 1, depending on whether you want to Disable or Enable the feature.
  12. So combining all these rules, and the command in our case transforms to:
    REG ADD “HKLM\Software\Policies\Google\Chrome” /v RendererCodeIntegrityEnabled /t REG_DWORD /d 0

    Add Registry using Command Prompt

How to Delete Registry using Command Prompt

Taking the same example as above, we will be deleting the DWORD (32-bit) file named RendererCodeIntegrityEnabled present under HKLM\Software\Policies\Google\Chrome. Follow along.

  1. Launch CMD as an administrator and refer to the below syntax.
    REG DELETE "Address" /v ValueName
  2. Here Address is the location of that registry file. In our case, it is
    HKLM\Software\Policies\Google\Chrome
  3. Next up, ValueName is the name of the registry file that you want to delete. In our case, it is
    RendererCodeIntegrityEnabled
  4. So combining them all, the command in our case will be:
    REG DELETE "HKLM\Software\Policies\Google\Chrome" /v RendererCodeIntegrityEnabled
  5. You will new get a confirmation, type in Y [for YES] and hit Enter.Add Registry using Command Prompt
  6. That’s it. The aforementioned registry file is now deleted.Delete Registry using Command Prompt

So these were the steps to add and delete registry values using Command Prompt. If you have any queries concerning the aforementioned steps, do let us know in the comments. We will get back to you with a solution at the earliest.


Share: