How To Use The Reg Add Command In Windows (2026)
The reg add command creates a registry key or sets a registry value from Command Prompt, with no Registry Editor window needed.
The basic form is reg add .
This guide follows Microsoft’s reg add and reg reference pages, so every switch below is documented.
Table of Contents
- Reg add quick answers
- Back up the registry before you change it
- Open Command Prompt
- The reg add syntax
- Registry root keys you can use
- Reg add switches at a glance
- Data types for the /t switch
- Add a value step by step
- Examples from Microsoft
- Check whether the command worked
- Choose the 32-bit or 64-bit registry view
- Look up a value with reg query before you add it
- Add a REG_MULTI_SZ value with a separator
- Mistakes that stop a reg add command
- Related reg commands
- Undo a change
- Related guides
- Official sources
- More Windows guides
Reg add quick answers
| I want to | Type this |
|---|---|
| Create a key | reg add HKCU\Software\MyCo |
| Set a number value | reg add HKCU\Software\MyCo /v Level /t REG_DWORD /d 1 /f |
| Set a text value | reg add HKCU\Software\MyCo /v Name /t REG_SZ /d Demo /f |
| Set the default (unnamed) value | reg add HKCU\Software\MyCo /ve /d Demo /f |
| Back up a key first | reg export HKCU\Software\MyCo C:\backup\MyCo.reg |
The MyCo key and the values here are placeholders, so swap in the real path from your instructions.
Back up the registry before you change it
Microsoft cautions that you should not edit the registry directly unless you have no alternative.
It says the registry editor bypasses standard safeguards, so incorrect settings can degrade performance, damage the system, or require reinstalling Windows.
Where possible, Microsoft recommends Control Panel or MMC programs instead, and a backup if you must edit directly.
Open Command Prompt
- Press the Windows key and type cmd.
- Right-click Command Prompt and choose Run as administrator.
- Type your reg add command and press Enter.
The steps for an elevated window are in how to open Terminal as administrator.
The reg add syntax
Microsoft gives the syntax as reg add .
The keyname is the full path and must start with a valid root key.
If the key name contains a space, enclose it in quotes.
Registry root keys you can use
| Short name | Full name |
|---|---|
| HKCR | HKEY_CLASSES_ROOT |
| HKCU | HKEY_CURRENT_USER |
| HKLM | HKEY_LOCAL_MACHINE |
| HKU | HKEY_USERS |
| HKCC | HKEY_CURRENT_CONFIG |
For a remote computer, put \\computername\ in front of the key name, and only HKLM and HKU are valid roots there.
Reg add switches at a glance
| Switch | What it does |
|---|---|
/v | Names the registry entry to add. |
/ve | Adds an entry with a null value. |
/t | Sets the data type of the entry. |
/s | Sets the character that separates items in a REG_MULTI_SZ value, and the default separator is \0. |
/d | Sets the data for the new entry. |
/f | Adds the entry without asking for confirmation. |
/reg:32 or /reg:64 | Accesses the key through the 32-bit or the 64-bit registry view. |
Data types for the /t switch
Microsoft lists nine accepted types.
REG_SZ,REG_MULTI_SZandREG_EXPAND_SZfor textREG_DWORD,REG_DWORD_LITTLE_ENDIANandREG_DWORD_BIG_ENDIANfor numbersREG_BINARY,REG_LINKandREG_FULL_RESOURCE_DESCRIPTORfor the rest
Add a value step by step
- Decide the full key path, the value name, the type and the data from the instructions you are following.
- Export the key first with
reg exportso you can undo the change..reg - Run
reg add./v /t /d - Answer the overwrite prompt, or add
/fto skip it. - Check the result with
reg query./v
Microsoft documents reg export as a local-only operation that writes a file with a .reg extension, and /y overwrites an existing file without asking.
Examples from Microsoft
| Goal | Command |
|---|---|
| Add a key on remote computer ABC | reg add \\ABC\HKLM\Software\MyCo |
| Add a REG_BINARY value named Data | reg add HKLM\Software\MyCo /v Data /t REG_BINARY /d fe340ead |
| Add a REG_MULTI_SZ value named MRU | reg add HKLM\Software\MyCo /v MRU /t REG_MULTI_SZ /d fax\0mail\0 |
| Add a REG_EXPAND_SZ value named Path | reg add HKLM\Software\MyCo /v Path /t REG_EXPAND_SZ /d ^%systemroot^% |
For a REG_EXPAND_SZ value, Microsoft says to use the caret symbol with each percent sign inside the data.
Check whether the command worked
The command returns 0 for success and 1 for failure.
Microsoft also notes that this version of reg does not ask for confirmation when adding a subkey, and that subtrees cannot be added with this operation.
Choose the 32-bit or 64-bit registry view
On a 64-bit system the same key path can exist in two views, and the /reg:32 and /reg:64 switches pick which one the command touches.
Use /reg:64 when you want the 64-bit view and /reg:32 when the software you are configuring is 32-bit.
If you leave both out, reg uses its default view, so name one whenever the instructions tell you to.
Look up a value with reg query before you add it
Running reg query on the key first shows whether the value already exists and what it holds.
| Switch | What it does in reg query |
|---|---|
/v | Returns only that value. |
/ve | Queries for value names that are empty. |
/s | Queries all subkeys and value names recursively. |
/f | Searches for the data or pattern given. |
/k or /d | Searches key names only, or data only. |
/c and /e | Make the search case sensitive, or return exact matches only. |
Microsoft’s example reg query HKLM\Software\Microsoft\ResKit /v Version shows the form to copy for a single value.
Add a REG_MULTI_SZ value with a separator
A REG_MULTI_SZ value holds several strings, and the /s switch sets the character that separates them in your /d data.
If you do not give a separator, Microsoft says the default is \0, as in the fax\0mail\0 example above.
Mistakes that stop a reg add command
- Leaving out the root key, because Microsoft says the key name must include a valid one such as HKCU or HKLM.
- Forgetting quotes around a key path that contains a space.
- Typing
%systemroot%without carets in a REG_EXPAND_SZ value, so the percent signs are not kept as text. - Using a root other than HKLM or HKU on a remote computer.
- Adding
/fbefore you have checked the path, which hides the overwrite prompt.
If the command prints an error and returns 1, fix the path or the type and run it again.
Related reg commands
| Command | What it does |
|---|---|
reg query | Lists the subkeys and entries under a key, and /s searches recursively. |
reg export | Copies a key into a .reg file. |
reg import | Copies the contents of an exported file back into the registry. |
reg delete | Deletes a subkey or entries, and /f skips the prompt. |
reg save and reg restore | Save subkeys to a file and write them back later. |
Undo a change
To put a key back, run reg import with the file you exported earlier.
To remove a value you added, run reg delete .
Microsoft says that reg delete with no value named removes all entries and subkeys under the subkey, so check the path twice.
Related guides
Other Windows commands are covered in the Robocopy guide, the Gpupdate guide and the Net User guide.
Official sources
The syntax, switches and examples come from Microsoft’s reg add reference.
The warning and subcommand list come from the reg reference, with the related commands documented on its reg query, reg export and reg delete pages.
More Windows guides
- How To Add A Child To Windows 11 With Family Safety (2026)
- How To Uninstall ESET From Windows Step By Step (2026)
- How To Uninstall Kaspersky Completely From Windows (2026)
- Local Security Authority Protection Is Off In Windows 11 (2026)
- How To Use Ping And Tracert In Windows 11 (2026)
- How To Change UAC Settings In Windows 11 (2026)
See all: Windows 11 Guides