This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can trysigning in orchanging directories.
Access to this page requires authorization. You can trychanging directories.
Adds a new subkey or entry to the registry.
reg add <keyname> [/v valuename | /ve] [/t datatype] [/s separator] [/d data] [/f] [/reg:32 | /reg:64]
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 thekeyname. Omitting\\<computername>\ causes the operation to default to the local computer. Thekeyname must include a valid root key. Valid root keys for the local computer are:
If a remote computer is specified, valid root keys are:HKLM andHKU. If the registry key name contains a space, enclose the key name in quotes. |
/v<Valuename> | Specifies the name of the add registry entry. |
/ve | Specifies that the added registry entry has a null value. |
/t<Type> | Specifies the type for the registry entry.Type must be one of the following:
|
/s<Separator> | Specifies the character to be used to separate multiple instances of data when theREG_MULTI_SZ data type is specified and more than one entry is 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. |
/reg:32 | Specifies the key should be accessed using the 32-bit registry view. |
/reg:64 | Specifies the key should be accessed using the 64-bit registry view. |
/? | Displays help at the command prompt. |
Subtrees can't be added with this operation. This version ofreg doesn't ask for confirmation when adding a subkey.
The return values for thereg add operation are:
Value | Description |
---|---|
0 | Success |
1 | Failure |
To add the keyHKLM\Software\MyCo on remote computerABC, type:
reg add \\ABC\HKLM\Software\MyCo
To add a registry entry toHKLM\Software\MyCo with a value namedData, the typeREG_BINARY, and data offe340ead, type:
reg add HKLM\Software\MyCo /v Data /t REG_BINARY /d fe340ead
To add a multi-valued registry entry toHKLM\Software\MyCo with a value namedMRU, the typeREG_MULTI_SZ, and data offax\0mail\0, type:
reg add HKLM\Software\MyCo /v MRU /t REG_MULTI_SZ /d fax\0mail\0
To add an expanded registry entry toHKLM\Software\MyCo with a value namedPath, the typeREG_EXPAND_SZ, and data of%systemroot%, type:
reg add HKLM\Software\MyCo /v Path /t REG_EXPAND_SZ /d ^%systemroot^%
Was this page helpful?
Was this page helpful?