Windows - Manage the registry using the command prompt

September 2016


Windows - Manage the registry using the command prompt



The registry can be edited via the command prompt using the REG command .

This command is useful when your computer is infected by a virus preventing access to the registry or when you want to create a batch that modifies the registry.

Open the command prompt


To get more information about the REG command, just add /? after the command.
Examples of use:
  • REG /?
  • REG ADD /?
  • REG COPY /?

Adding items to the registry

Add a key

REG ADD [location of the key][name of the new key] 

Add a value

  • REG ADD [location of the new value]/V[value name]/T [value type]/D [value data] 
  • The /T is to specify the type of value to add. There are six types of values:
  • REG_SZ
  • REG_MULTI_SZ
  • REG_EXPAND_SZ
  • REG_DWORD
  • REG_BINARY
  • REG_NONE

Add default value

REG ADD [location of the new value]/VE/D [data value]  

Deleting items from the registry

Delete a key

  • REG DELETE [key name]  

Removes the selected key, subkeys and values it contains.

Delete a value

  • REG DELETE [key name]/V[value name] 

Delete the default value

  • REG DELETE [key name]/VE 

Related :

This document entitled « Windows - Manage the registry using the command prompt » from CCM (ccm.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.