Contents

Method

RegistryDeleteKey

ModuleNativeServices
LibraryCore
Action


Delete a registry key.

Parameters

Hive (string): The registry hive which has to match one of the following long or short names, ignoring case:

Long NameShort Name
HKEY_CLASSES_ROOTHKCR
HKEY_CURRENT_CONFIGHKCC
HKEY_CURRENT_USERHKCU
HKEY_LOCAL_MACHINEHKLM

Subkey (string): The registry key to look for.

Return values

Status (string)

  • If the key was successfully deleted, set to "Deleted key".
  • If the key does not exist, nothing is returned, i.e. success no content.
  • If the parent key does not exist, set to (slightly misleadingly) "Key does not exist".

If some other registry error occurs, the method fails with a descriptive message.

Example
 NativeServices.RegistryDeleteKey(Hive:"HKLM", Subkey:"software\\1e\\test\\test2");
Platforms
  • Windows
Notes

 To delete keys in the HKEY_USERS hive, use NativeServices.RegistryDeleteUserKey.