RegDelete()

Auto Hotkey

RegDelete

Deletes a value or subkey from the registry.

RegDelete KeyName, ValueName
RegDeleteKey KeyName
Command  Example: RegDelete "HKEY_LOCAL_MACHINE\Software\SomeApplication", "TestValue"
Function Example: RegDelete("HKEY_LOCAL_MACHINE\Software\SomeApplication", "TestValue")

Parameters

KeyName

The full name of the registry key.

This must start with HKEY_LOCAL_MACHINE, HKEY_USERS, HKEY_CURRENT_USER, HKEY_CLASSES_ROOT, or HKEY_CURRENT_CONFIG (or the abbreviations for each of these, such as HKLM). To access a remote registry, prepend the computer name and a slash, as in this example: \\workstation01\HKEY_LOCAL_MACHINE

KeyName can be omitted only if a registry loop is running, in which case it defaults to the key of the current loop item. If the item is a subkey, the full name of that subkey is used by default. If the item is a value, ValueName defaults to the name of that value, but can be overridden.

ValueName

The name of the value to delete. If blank or omitted, the key's default value will be deleted (except as noted above). The default value is displayed as "(Default)" by RegEdit.

ErrorLevel

ErrorLevel is set to 1 if there was a problem or 0 otherwise.

A_LastError is set to the result of the operating system's GetLastError() function.

Remarks

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

To retrieve and operate upon multiple registry keys or values, consider using a registry loop.

Within a registry loop, RegDelete and RegDeleteKey do not necessarily delete the current loop item. If the item is a subkey, RegDelete() only deletes its default value while RegDeleteKey() deletes the key itself. If the item is a value, RegDeleteKey() deletes the key which contains that value, including all subkeys and values.

For details about how to access the registry of a remote computer, see the remarks in registry loop.

To delete entries from the 64-bit sections of the registry in a 32-bit script or vice versa, use SetRegView.

Related

RegRead, RegWrite, Registry-loop, SetRegView, IniDelete

Example

RegDelete, HKEY_LOCAL_MACHINE\Software\SomeApplication, TestValue