CMD Line Registry Delete
September 14, 1999 05:14 PM
How can I delete a registry value/key from the command line?

Rating:

(6)
Windows IT Pro
InstantDoc ID #14741
A. A. Using the Windows NT Resource Kit Supplement 2 utility REG.EXE you can delete a registry value from the command line or batch file, e.g.
reg delete HKLM\Software\test
Would delete the HKEY_LOCAL_MACHINE\Software\test value. When you enter the command you will be prompted if you really want to delete, enter Y. To avoid the confirmation add /force to the command, e.g.
reg delete HKLM\Software\test /force
A full list of the codes to be used with REG DELETE are as follows:
HKCR |
HKEY_CLASSES_ROOT |
HKCU |
HKEY_CURRENT_USER |
HKLM |
HKEY_LOCAL_MACHINE |
HKU |
HKEY_USERS |
HKCC |
HKEY_CURRENT_CONFIG |
To delete a entry on a remote machine add the name of the machine, \\<machine name>, e.g.
reg delete HKLM\Software\test \\johnpc
Inserted from <http://www.windowsitpro.com/article/registry2/how-can-i-delete-a-registry-value-key-from-the-command-line-.aspx>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Deleting Registry Keys from the Command Line
There are two ways to delete a key from the Registry from the Command line. At the Windows Command line:
RegEdit /l location of System.dat /R location of User.dat /D Registry key to delete
You cannot be in Windows at the time you use this switch.
Or you can create a reg file as such:
REGEDIT4
[-HKEY_LOCAL_MACHINE\the key you want to delete]
Note the negative sign just behind the[
Then at the Command line type:
1. RegEdit C:\Windows\(name of the regfile).
Pasted from <http://www.easydesksoftware.com/regtrick.htm>