≡ Menu

Add registry key command line

Using reg command we can add registry key from command line.  Below you can find some examples for the same.

Add a new registry value:

The command for adding new registry value is given below.

Reg Add Regkey /v RegValue /t RegType /d data

Regkey – Path of the node where the new registry value should be added.

RegValue : Name of the registry value that should be added

/t: Type of the registry value (REG_SZ, REG_DWORD, REG_BINARY)

Example:
Add a new registry value ‘userpath’ of type REG_EXPAND_SZ under the node ‘HKEY_CURRENT_USER\Environment’. Assign the value ‘C:\Windows’ to this new registry value.

reg  add  HKEY_CURRENT_USER\Environment  /v  userpath /t  REG_EXPAND_SZ  /d  C:\Windows

Add a new registry key

The command for adding new registry key is given below.

Reg  Add  Regkey

Example:
Add a new registry key ‘HKEY_CURRENT_USER\Software\Newregkey’.

reg  add  HKEY_CURRENT_USER\Software\Newregkey

Related Posts:

Delete registry key from Windows command prompt

2 comments… add one
  • Patrick Michael McLaughlin

    What happens if the full path doesn’t exist though, does it create the folder?

  • Rand L Petersen

    please expand on how to do this for us new newbies! Is this what I need to get console input of “regedit.exe” not result in “not recognized as internal or external command. Thank you.

Leave a Comment