Share this page : facebooktwitterlinkedinmailfacebooktwitterlinkedinmail


Adds a new subkey or entry to the registry.

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

For examples of how to use this command, see Examples.

Parameter Description
<KeyName> Specifies the full path of the subkey or entry to be added. To specify a remote computer, include the computer name (in the format \\<ComputerName>\) as part of the KeyName. Omitting \\ComputerName\ causes the operation to default to the local computer.

The KeyName must include a valid root key. Valid root keys for the local computer are:

  • HKLM
  • HKCU
  • HKCR
  • HKU
  • HKCC.

If a remote computer is specified, valid root keys are: HKLM and HKU.

/v <ValueName> Specifies the name of the registry entry to be added under the specified subkey.
/ve Specifies that the registry entry that is added to the registry has a null value.
/t <Type> Specifies the type for the registry entry. Type must be one of the following:

  • REG_SZ
/s <Separator> Specifies the character to be used to separate multiple instances of data when the REG_MULTI_SZ data type is specified and more than one entry needs to be listed. If not specified, the default separator is \0.
/d <Data> Specifies the data for the new registry entry.
/f Adds the registry entry without prompting for confirmation.
/? Displays help for reg add at the command prompt.
  • Subtrees cannot be added with this operation. This version of reg does not ask for confirmation when adding a subkey.
  • The following table lists the return values for the reg add operation.
Value Description
0 Success
1 Failure
  • For the REG_EXPAND_SZ key type, use the caret symbol ( ^ ) with %” inside the /d parameter

To add the key HKLM\Software\MyCo on remote computer ABC, type:

REG ADD \\ABC\HKLM\Software\MyCo

To add a registry entry to HKLM\Software\MyCo with a value named Data, type REG_BINARY, and data of fe340ead, use command:

REG ADD HKLM\Software\MyCo /v Data /t REG_BINARY /d fe340ead

To add a multivalued registry entry to HKLM\Software\MyCo with a value name of MRU of type REG_MULTI_SZ and data of fax\0mail\0\0, type:

REG ADD HKLM\Software\MyCo /v MRU /t REG_MULTI_SZ /d fax\0mail\0\0

To add an expanded registry entry to HKLM\Software\MyCo with a value name of Path of type REG_EXPAND_SZ and data of %systemroot%, type:

REG ADD HKLM\Software\MyCo /v Path /t REG_EXPAND_SZ /d ^%systemroot^%


Use Reg file


Create a file with extension name .reg, edit it by any text editor:

  • First line: Windows Registry Editor Version 5.00
  • Then type the hive, if the hive does not exist, the registry will create one: [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
  • Value name, type, and value data :  “test”=dword:00000001

The whole file will looks like:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System] “test”=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\frank] “test”=dword:00000001

Save the file in the format of name.reg . then double click the file. Done!