Archive: Need code in NSIS "Uninstall Section" to remove program in "Add & Remove Programs


Need code in NSIS "Uninstall Section" to remove program in "Add & Remove Programs
Greetings,

NSIS is excellent btw. Super great installer tool.

This question is for WinXP platform only.

My installer/uninstaller works great, but I need to ALSO uninstall another program located in Control Panel "Add & Remove Programs" if it exists.

How do I look for the program in Control Panel "Add & Remove Programs" and initiate the "Remove" action from within NSIS Uninstall Section module.

Thanks,
BD


If the registry key used by the other programs for uninstall information is static (the same on all machines), just read HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\<program's_folder\UninstallString and execute the file referenced in that key. For example, if I wanted to remove NSIS, I'd do something like this:

ReadRegStr$0HKLMSOFTWAREMicrosoftWindowsCurrentVersionUninstallNSISUninstallString

ExecWait
"$0"
However, if the uninstaller is not/cannot be automated, note that the application may not be uninstalled after all. If the other application MUST be removed, you can catch the user in a loop until the registry key no longer exists.

Hey Pidgeot,

Thks for the code, upon reviewing the Registry for this path, the program I want to uninstall isn't in this list, it's in "...\CurrentVersion\Installer\UserData\S-1-5....1005\Products\A6......D76\InstallProperties\DisplayName" UninstallString

where DisplayName is the program I wish to uninstall, DisplayName property is what shows the Application Name in Control Panel to uninstall the program, of which, the uninstall here works fine, I need to force this uninstall automatically.

my concern is the "S-1-5..1005" and "A6..D76" won't be the same on every computer to properly find this particular program to uninstall if I give this full path.

Do you know how I can "search" for the DisplayName to match the desired program name via loop, then grab the UninstallString ?