Skip to content
⌘ NSIS Forum Archive

Uninstall Start menu shortcut

2 posts

MB1#

Uninstall Start menu shortcut

Hi
Env Win 7 Nsis 3.08
I'm new about nsis.. i just succesfully create some simple NSIS scrpt to install my programs
The question is about start menu shortcut unistalling
i succesfully write code to let to installer to choose start menu folder
i put here the interested code

XPStyle on
Page custom StartMenuGroupSelect "" ": Start Menu Folder"
UninstPage uninstConfirm
UninstPage instfiles

Function StartMenuGroupSelect
Push $R1

StartMenu::Select /checknoshortcuts "Don't create a start menu folder" /autoadd /lastused $R0 "MP3 Downloader"
Pop $R1

StrCmp $R1 "success" success
StrCmp $R1 "cancel" done
; error
MessageBox MB_OK $R1
StrCpy $R0 "MP3 Downloader" # use default
Return
success:
Pop $R0

done:
Pop $R1
FunctionEnd
Section "Start Menu Shortcuts"
# this part is only necessary if you used /checknoshortcuts
StrCpy $R1 $R0 1
StrCmp $R1 ">" skip

CreateDirectory $SMPROGRAMS\$R0
CreateShortcut $SMPROGRAMS\$R0\MP3_Dowmloader.lnk $INSTDIR\MP3_Downloader.bat
CreateShortcut "$SMPROGRAMS\$R0\MP3 Updater.lnk" "$INSTDIR\Updater.bat"

skip:
SectionEnd
the question is how to reference the directory $SMPROGRAMS\$R0
in the unistallal section ?

i tried

Delete "$SMPROGRAMS\$R0\MP3_Dowmloader.lnk"
Delete "$SMPROGRAMS\$R0\MP3 Updater.lnk"
RMDir "$SMPROGRAMS\$R0"
but it does not function ..
i'm not using the modern interface..and if possible i do not want to use it..
Thanks in advance for the support
Anders#
Classic NSIS does not write anything anywhere automatically, you need to save the folder name in the installer. You can save it in a .ini file or in the registry. Restore the variable in your uninstaller.

Ideally you should just have a single shortcut in $SMPROGRAMS. The Microsoft guidelines say you should not create shortcuts to updaters/uninstallers/help etc.