# CMD Line Registry Delete September 14, 1999 05:14 PM How can I delete a registry value/key from the command line?
- [bookmark](http://www.addthis.com/bookmark.php) - [reprints](http://license.icopyright.net/3.7009?icx_id=14741) - [Email](http://www.windowsitpro.com/article/registry2/how-can-i-delete-a-registry-value-key-from-the-command-line-.aspx) - [Print](http://www.windowsitpro.com/print/registry2/how-can-i-delete-a-registry-value-key-from-the-command-line-.aspx) - [Comments](http://www.windowsitpro.com/article/registry2/how-can-i-delete-a-registry-value-key-from-the-command-line-.aspx#Rate) Rating:
(6) [John Savill](http://www.windowsitpro.com/author/198/JohnSavill.aspx) 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](http://www.windowsitpro.com/article/registry2/how-can-i-delete-a-registry-value-key-from-the-command-line-.aspx), 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](http://www.windowsitpro.com/article/registry2/how-can-i-delete-a-registry-value-key-from-the-command-line-.aspx)\\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](file://%3Cmachine/) name>, e.g. reg delete HKLM\\Software\\test [\\\\johnpc](file://johnpc/) Inserted from <[http://www.windowsitpro.com/article/registry2/how-can-i-delete-a-registry-value-key-from-the-command-line-.aspx](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](http://www.easydesksoftware.com/regtrick.htm)>