Delete a value from the Registry.
Syntax
objShell.RegDelete "strRegName"
Arguments:
objShell A WScript.Shell object
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 objShell = Wscript.CreateObject("Wscript.Shell")
objShell.RegDelete "HKCU\Control Panel\Desktop\MyValue"
objShell.RegDelete "HKCU\Control Panel\Desktop\MyKey\"
Delete SubKeys in order
objShell.RegDelete ("HKCU\Control Panel\Desktop\MyKey\MySubKey\");
objShell.RegDelete ("HKCU\Control Panel\Desktop\MyKey\");
“The way to love anything is to realize it might be lost” ~ G. K. Chesterton
Related:
Registry, read - .RegRead
Registry, write - .RegWrite
Equivalent Windows CMD command:
REG - Read, Set or Delete registry keys and values
Equivalent PowerShell cmdlet: Remove-Item