How can I delete a Windows registry key?
You can delete a registry key using a <registryDelete>
action. If the key to delete does not exist, the action will be ignored. You will have to include a section like the one below inside an action list section of your XML installer project file.
<registryDelete>
<key>
HKEY_
LOCAL_
MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment</key>
<name>
MY_APPDIR</name>
</registryDelete>