While using Linux I've grown accustomed to one-liners when I search online to fix annoying defaults. I know that these one liners could be very dangerous so I always make sure I know what they are doing before running them.

At the same time, I hate having to update windows registry keys because I need to open up regedit and navigate The Tree.

Is there an easy way to edit a specific registry value?

Something like:

regupdate path type newvalue
  • "I hate having to update windows registry keys because I need to open up regedit and navigate The Tree." - Besides all the answers below, why not switch to a better registry editor that allows you to directly jump to a specific key?
    – Karan
    Nov 30, 2012 at 0:43
  • @Karan I'm open to suggestions.
    – AnnanFay
    Nov 30, 2012 at 2:02
  • 1
  • Considering that link is currently dead, I suppose the answer to that question is a no... Mar 1, 2017 at 23:49
  • See also superuser.com/questions/607572/…
    – Vadzim
    May 25, 2018 at 20:55

4 Answers 4


As of the time of writing this, the accepted answer to this by David Marshall answers the question, but doesn't provide any detail beyond the link itself. In the interest of writing an answer that is both easily readable and invulnerable to potential link rot, I decided to write my own answer to the question.

How do I update the Windows Registry using the command line?

The reg command, made available from as far back as Windows Server 2000, is used for this exact purpose, and the syntax is fairly simple to use.

To add a key

Run the following in a command line window:

reg add HKLM\Software\Classes\MyKey

...where HKLM\Software\Classes\MyKey is the registry key that you want to create.

To add registry values and data along with keys, parameters are required. The /v parameter specifies the name of the value to be added, the /t parameter specifies the value type, and the /d parameter specifies the data to be contained within the value.

To add the key HKLM\Software\Classes\MyKey with a DWORD value named LegacyDisable that contains data of 000:

reg add HKLM\Software\Classes\MyKey /v LegacyDisable /t reg_dword /d 000

To delete a key

reg delete HKLM\Software\Classes\MyKey

Parameters include /v, for deleting a particular value within a key instead of the key itself; /ve, to delete a key only if it contains no values; and /f, which overrides the command's default behaviour of waiting for user confirmation and forces the deletion.

To delete a value within a key:

reg delete HKLM\Software\Classes\MyKey /v ValueName

To compare two keys

The reg command's compare also allows you to compare two registry keys, listing the differences between the two by default:

reg compare HKCR\.doc HKCR\.docx

To change the default behaviour of listing differences, and instead list both the differences and similarities between two different keys, use the /oa parameter.

  • When adding or modifying a registry key that contains spaces, make sure to wrap the key in quotes to avoid a bad syntax error.

  • When referring to any of the registry hives in a key path - HKEY_LOCAL_MACHINE, HKEY_CLASSES_ROOT, HKEY_CURRENT_USER, HKEY_USERS and HKEY_CURRENT_CONFIG - the reg command allows referencing them using their abbreviated versions - HKLM, HKCR, HKCU, HKU, and HKCC respectively - as demonstrated in the examples above.

  • When a command is about to overwrite a currently-existing value, CMD defaults to prompting for confirmation. To bypass this confirmation, use the /f parameter to force the overwrite.


The Reg command does what you require.

  • This is what I'm looking for! I'm surprised I didn't hear about it before.
    – AnnanFay
    Nov 30, 2012 at 3:40
  • 1
    Can you edit to improve your answer? Link only answers are discouraged, as they may go down at any time, leaving no content in the answer. Jan 26, 2018 at 17:35

You can create a .REG file to update it for you.

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main]

Copy the code into a new Notepad window, and save the file with a .REG extention. When you run it (i.e. START /w file.reg, it will ask you to merge the contents


If you're open to Powershell you could use its Set-ItemProperty cmdlet.
Here is an article on the subject.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .