Reference/DeleteRegKey

From NSIS Wiki
Jump to navigationJump to search

DeleteRegKey

[/ifempty] root_key subkey

Deletes a registry key. If /ifempty is specified, the registry key will only be deleted if it has no subkeys (otherwise, the whole registry tree will be removed). Valid values for root_key are listed under WriteRegStr. The error flag is set if the key could not be removed from the registry (or if it didn't exist to begin with).

DeleteRegKey HKLM "Software\My Company\My Software\"
DeleteRegKey /ifempty HKLM "Software\A key that might have subkeys\"

The registry key must end with a backslash in the DeleteRegKey call. Otherwise the registry key cannot be removed.