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 clave

    Shows the values of a key; /s includes subkeys.

  • add clave

    Adds a key or a value.

  • delete clave

    Deletes a key or a value.

  • export clave fichero

    Saves a key to a .reg file.

  • import fichero

    Imports a .reg file into the registry.

  • /v nombre

    Name of the value to act on.

  • /t tipo

    Value type: REG_SZ, REG_DWORD, REG_EXPAND_SZ...

  • /d datos

    Value data.

  • /f

    Forces the operation without asking for confirmation.

Usage examples

  • reg query HKCU\Environment

    Shows the user environment variables stored in the registry.

  • reg add HKCU\Software\Demo /v Clave /d valor

    Creates the Clave value with the text valor.

  • reg export HKCU\Software\Demo demo.reg

    Backs up the key to a file.

  • reg delete HKCU\Software\Demo /f

    Deletes 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.

Related commands