Previous Topic: regCreateSubkeys--Create Subkeys From an Array (Function)Next Topic: regDeleteVal--Delete a Registry Value (Function)


regDeleteKey--Delete a Registry Key or a Key Hierarchy (Function)

The regDeleteKey function removes a key and all associated values from the registry on the local system or a remote system. If the specified key contains subkeys, the removal fails by default. However by passing true for fRecurse the function deletes sKey including all nested subkeys.

The function has the following syntax:

regDeleteKey(sKey [, fRecurse])
sKey

Specifies the registry key

, fRecurse

Deletes nested subkeys.

If the function fails, it raises an exception. Otherwise it returns true.

Examples

Delete key named "Settings" from HKLM\Software\ACME with error handling:

try {
    regDeleteKey("HKLM\\Software\\ACME\\Settings");
    ? "Success"
}
catch(e) {
    ? "Failure:", e
}

Delete "Settings" key forcing recursive delete of subkeys:

regDeleteKey("HKLM\\Software\\ACME\\Settings", true);

Delete "Settings" key on remote machine client8:

regDeleteKey("client8::HKLM\\Software\\ACME\\Settings");

See also

regCreateKey--Create a Registry Key (Function)

regDeleteVal--Delete a Registry Value (Function)