Archive: Uninstaller not deleting start menu shortcuts


Uninstaller not deleting start menu shortcuts
Using NSIS 2.37, target machines experiencing the problem are running Win XP SP2 and Win Server 2003 R2 SP2. My uninstaller is not deleting the start menu shortcuts, let alone the start menu folders that were created upon installation. It does delete all the other files it originally installed - the only problem is with the start menu folders and shortcuts. I'm new to NSIS - any help would be appreciated. Thanks!

This is my NSIS code to install the start menu shortcuts and folders (works fine):

;Create start menu shortcuts in the start menu programs directory, pointing each shortcut to the appropriate executable, assigning each the RM Dash icon                
CreateDirectory "$SMPROGRAMS\RM Dashboard"
CreateDirectory "$SMPROGRAMS\RM Dashboard\$Project_name"
createShortCut "$SMPROGRAMS\RM Dashboard\$Project_name\Run Administrator Console.lnk" "$SYSDIR\wscript.exe" '/B "$INSTDIR\Run Administrator Console.vbs"' "$INSTDIR\RMDash-Icon-V2.ico"
createShortCut "$SMPROGRAMS\RM Dashboard\$Project_name\Run Company Configuration Console.lnk" "$SYSDIR\wscript.exe" '/B "$INSTDIR\Run Company Configuration Console.vbs"' "$INSTDIR\RMDash-Icon-V2.ico"
createShortCut "$SMPROGRAMS\RM Dashboard\$Project_name\Run Requirement Metrics Dashboard.lnk" "$SYSDIR\wscript.exe" '/B "$INSTDIR\Run RMD.vbs"' "$INSTDIR\RMDash-Icon-V2.ico"
createShortCut "$SMPROGRAMS\RM Dashboard\$Project_name\Product Training Presentation.lnk" "$INSTDIR\Requirement Metrics Dashboard Training 0.52.ppt"
createShortCut "$SMPROGRAMS\RM Dashboard\$Project_name\Uninstall.lnk" "$INSTDIR\Uninstall.exe"



This is my NSIS uninstaller code to remove the start menu shortcuts and folders (compiles but does not remove anything):
;Remove start menu shortcuts and folders                 
delete "$SMPROGRAMS\RM Dashboard\$Project_name\Run Administrator Console.lnk"
delete "$SMPROGRAMS\RM Dashboard\$Project_name\Run Company Configuration Console.lnk"
delete "$SMPROGRAMS\RM Dashboard\$Project_name\Run Requirement Metrics Dashboard.lnk"
delete "$SMPROGRAMS\RM Dashboard\$Project_name\Product Training Presentation.lnk"
delete "$SMPROGRAMS\RM Dashboard\$Project_name\Uninstall.lnk"
RMDir "$SMPROGRAMS\RM Dashboard\$Project_name"

why is $Project_name a variable and not a define? Are you setting it to the same value in the uninstaller AND the installer? Try MessageBox mb_ok "$SMPROGRAMS\RM Dashboard\$Project_name\" in the uninstaller and make sure the path is correct


The message box revealed that the uninstaller is trying to delete the start menu shortcuts and folders from the *username's* start menu (e.g. C:\Documents and Settings\username\Start Menu\Programs\RM Dashboard\). However, the start menu shortcuts and folders are installed to *all users* start menu (C:\Documents and Settings\All Users\Start Menu\Programs\RM Dashboard\). I want the shortcuts and folders to be installed to all users' start menu, so how do I direct the uninstaller to delete those?
Thanks!


SetShellVarContext all


I think I'm getting bitten by having my $Project_name in a var instead of a define. I have it as a var right now because user input during the install process sets this var. However my Uninstall section needs to know this var too. How can I get my Uninstall section to know about the $Project_name var set by the user during installation? Upon closer inspection, the MessageBox was showing the path with a missing folder (note "\\" between "Dashboard" and "Run"):

C:\Documents and Settings\All Users\Start Menu\Programs\RM Dashboard\\Run Administrator Console.lnk

There should be a project folder between the two backslashes. That message box was driven by this code:

MessageBox mb_ok "$SMPROGRAMS\RM Dashboard\$Project_name\Run Administrator Console.lnk"

The $Project_name variable works in all the other sections but the Uninstall section does not appear to be able to read it. Any ideas?

Thanks for your help!!


save it in the registry or a ini file during install and restore it in the uninstaller (it is also possible to save stuff inside the uninstaller at the end of the exe)