NT Syntax

REGEDIT

Import, export or delete registry settings from a text (.REG) file

syntax
      Export the Registry (all HKLM plus current user)
      REGEDIT /E pathname

      Export part of the Registry
      REGEDIT /E pathname "RegPath"

      Import a reg script
      REGEDIT pathname

      Silent import
      REGEDIT /S pathname

      Start the regedit GUI
      REGEDIT 

key
   /E : Export 

   /S : Silent Import

How to delete keys and values from the registry:

Create a reg file like this, notice the hyphen inside the first bracket

REGEDIT4
[-HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SomeKey]  

When double clicking this .reg file the key "SomeKey" will be deleted along with all string, binary or Dword values in that key.

If you want to just delete values leaving the key in place, set the value you want to delete = to a hyphen
e.g.

REGEDIT4
[HKEY_CURRENT_USER\Control Panel\SomeKey]
"SomeStringValue"=-
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SomeKeyName]
"SomeDword"=- 

Again double clicking this .reg file will delete the values specified - or you can use REGEDIT /s MyDeleteScript.REG.

Windows XP Registry files.
Under NT and 2K all registry scripts start with:
REGEDIT4

Under XP this first line changes to:
Windows Registry Editor Version 5.00

REGEDIT is backwards compatible so Win XP will still run scripts created with earlier versions.

Related commands:

REGEDT32.EXE - Edit the registry including Security and Auditing Options
REG - Read, Set or Delete registry keys and values
SETX - Set environment variables permanently
Dureg - Registry Size Estimator. (Win 2K ResKit)

Equivalent Linux BASH commands:

none


Back to the Top

Simon Sheppard
SS64.com