Error DataBase-One Place all Solutions Forums Blog Glossary    Contact Us
Search  
   
Browse by Category
Error DataBase-One Place all Solutions .: Operating Systems .: Windows Operating Systems .: Windows 2000 .: How to Import, export or delete registry settings

How to Import, export or delete registry settings

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 

      Open multiple copies of GUI (XP and 2003 only)
      REGEDIT -m

Key
   /E : Export 

   /S : Silent Import

How to add keys and values from the registry:

Create a text file like this:

REGEDIT4
[HKEY_CURRENT_USER\SomeKey]
"SomeStringValue"="Hello" 

When double clicking this .reg file the key and value will be added.
Alternatively run REGEDIT MYKEY.REG from the command line.

How to delete keys and values from the registry:

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

REGEDIT4
[-HKEY_CURRENT_USER\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\SomeKey]
"SomeStringValue"=-

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

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

Under Windows 2K and XP the first line is:
Windows Registry Editor Version 5.00

To be sure that a .REG script will run under any version of Windows use the earlier syntax: REGEDIT4.


Comments
Within a registry file, comments can be preceded by "; "
e.g.
;
; Turn the NUMLOCK on at login
;
[HKEY_CURRENT_USER\Control Panel\Keyboard]
"InitialKeyboardIndicators"="2"


How helpful was this article to you?

Related Articles

article VB Script to Delete Registry Value
Option Explicit Dim SysVarReg

(No rating)  3-24-2008    Views: 304   
article VB Script to Delete Registry Key
Option Explicit Dim RegPath

(No rating)  3-24-2008    Views: 292   
article How to add, modify, or delete registry subkeys and values by using a registration entries (.reg) file
 If you use Registry Editor...

  2-1-2008    Views: 3505   

User Comments

Add Comment
No comments have been posted.