Home NT WSH
WshShell.RegDelete

Delete a value from the Registry

Syntax 
      WshShell.RegDelete "strRegName"

Arguments:

         strRegName : 
         To delete a key instead of a value terminate strRegName 
         with a backslash character \

         strRegName must start with one of

         HKEY_CURRENT_USER  or HKCU
         HKEY_USERS         
         HKEY_LOCAL_MACHINE or HKLM
         HKEY_CLASSES_ROOT  or HKCR
         HKEY_CURRENT_CONFIG

Example

Set WshShell = Wscript.CreateObject("Wscript.Shell")
WshShell.RegDelete "HKCU\Control Panel\Desktop\MyValue"
WshShell.RegDelete "HKCU\Control Panel\Desktop\MyKey\"

Delete SubKeys in order...
WshShell.RegDelete ("HKCU\Control Panel\Desktop\MyKey\MySubKey\");
WshShell.RegDelete ("HKCU\Control Panel\Desktop\MyKey\");

"The way to love anything is to realize it might be lost" - G. K. Chesterton

Related commands:

Registry, read - WshShell.RegRead
Registry, write - WshShell.RegWrite

Equivalent Windows NT command:

REG - Read, Set or Delete registry keys and values



Back to the Top

Simon Sheppard
SS64.com