Function Reference


RegDelete

Deletes a key or value from the registry.

RegDelete ( "keyname" [, "valuename"] )

Parameters

keyname The registry key to delete.
valuename [optional] The valuename to delete.

Return Value

Success: 1.
Special: 0 if the key/value does not exist.
Failure: 2 if error deleting key/value and sets the @error flag to non-zero.
@error: 1 = unable to open requested key
 2 = unable to open requested main key
 3 = unable to remote connect to the registry
-1 = unable to delete requested value
-2 = unable to delete requested key/value

Remarks

A registry key must start with "HKEY_LOCAL_MACHINE" ("HKLM") or "HKEY_USERS" ("HKU") or "HKEY_CURRENT_USER" ("HKCU") or "HKEY_CLASSES_ROOT" ("HKCR") or "HKEY_CURRENT_CONFIG" ("HKCC").

When running on 64-bit Windows if you want to delete a key or value specific to the 64-bit environment you have to suffix the HK... with 64 i.e. HKLM64.

To access the (Default) value use "" (an empty string) for the valuename.

Deleting from the registry is potentially dangerous--please exercise caution!

It is possible to access remote registries by using a keyname in the form "\\computername\keyname". To use this feature you must have the correct access rights.

Related

RegEnumKey, RegEnumVal, RegRead, RegWrite

Example

RegDelete("HKEY_CURRENT_USER\Software\Test", "TestKey")

RegWrite("HKEY_CURRENT_USER\Software\Test")
RegWrite("HKEY_CURRENT_USER\Software\Test1")