reg
Windows CMD · System · reference only
What it does
Queries and modifies the Windows Registry from the command line: it adds, deletes, exports and imports keys and values.
Syntax
reg query|add|delete|export|import clave [opciones]
Options and parameters
query claveShows the values of a key; /s includes subkeys.
add claveAdds a key or a value.
delete claveDeletes a key or a value.
export clave ficheroSaves a key to a .reg file.
import ficheroImports a .reg file into the registry.
/v nombreName of the value to act on.
/t tipoValue type: REG_SZ, REG_DWORD, REG_EXPAND_SZ...
/d datosValue data.
/fForces the operation without asking for confirmation.
Usage examples
reg query HKCU\EnvironmentShows the user environment variables stored in the registry.
reg add HKCU\Software\Demo /v Clave /d valorCreates the Clave value with the text valor.
reg export HKCU\Software\Demo demo.regBacks up the key to a file.
reg delete HKCU\Software\Demo /fDeletes the key without asking for confirmation.
Notes and common mistakes
- Always make a copy with reg export before modifying or deleting.
- A wrong registry change can damage the system; HKLM requires administrator.