Any of the above commands can be run against a remote machine by adding \\MachineNameto the command line, assuming the Remote Registry Service is running.

Registry paths which contain a space must be enclosed by quotation marks:"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList\"
It is easy to miss one space in a long path so it
is not a bad practice to simply surround all registry paths with quotes.

Depending on the registry permissions, REG ADD may require running REG.exe from an elevated command prompt.
Registry data stored under HKCU will be visible and writable by the currently logged in user.
Registry data stored under HKLM will be visible to all users and writable only by administrators.

REG RESTORE has a tendency not to work, possibly due to firewall issues, EXPORT and IMPORT are much more reliable.

Backslash characters

The REG command will interpret \ as an escape for the character that immediately follows it.
To include a quote mark (") in the data, prefix it with the escape character e.g. Here is \" a quote

This can cause problems with quoted directory paths because \" at the end of the line will be escaped.

To save a directory path with a trailing backslash (\) requires adding a second backslash to 'escape' the escape
so for example instead of "C:\My Docs\" use "C:\My Docs\\"

Activate

Elevation

Unlike REGEDIT, REG.exe does not always require elevation
When adding an item to HKCU, REG will be automatically manifested “asInvoker”, and will work without elevation,
when adding an item to HKLM then it does need to be run elevated.

Examples

Querying the console settings:

REG QUERY HKCU\Console\
REG QUERY HKCU\Console /v ScreenBufferSize

Add the registry key 'Sample' along with some data and then query to check that it worked:REG ADD HKCU\Software\SS64 /v Sample /d "some test data"
REG QUERY HKCU\Software\SS64 /v Sample

Add the registry key to disable Fast User Switching on the current PC (requires elevation)

To save a progress log as part of a RunOnce command you can include redirection to a log file as part of the command string, however to make this work the redirection characters and quotes must be escaped:... "setup.cmd ^>^> \"C:\Temp\setup.log\"\"" /f

More examples are available via: REG QUERY /? REG ADD /? etc

"The way to a mans heart is through his stomach" ~ Fanny Fern (writer)

Related:

SETX - Set environment variables permanently, can also read a registry key and write the value to a text file.REGEDIT - Load Registry settings from a .REG file
Powershell: Get-ItemProperty / Set-ItemProperty - Retrieve / save registry Keys.Q305097 - View the system registry using a 64-bit version of Windows.Q325347 - Run a Logon Script once when a new user logs on, Windows 2003.Q945219 - Reg.exe fails for REG_EXPAND_SZ registry types.