I'm trying to create an installer using NSIS Modern User Interface for the first time. I would like to know how I can add an option (checkbox) for users to select to have a desktop shortcut created on the Finish Page (the last screen of the installer) in addition to the "Run XXXX" option that's already there.
Right-click on .exe file and choose to create a shortcut; Go to properties of the shortcut and select an icon and choose a meaningful name; Add the shortcut on User's Desktop and User's Programs Menu.
Click the Windows key, and then browse to the Office program for which you want to create a desktop shortcut. Right-click the program name or tile, and then select Open file location. Right-click the program name, and then click Send To > Desktop (Create shortcut). A shortcut for the program appears on your desktop.
NSIS installers are generated by using the 'MakeNSIS' program to compile a NSIS script (. NSI) into an installer executable. The NSIS development kit installer sets up your computer so that you can compile a . nsi file by simply right-clicking on it in Explorer and selecting 'compile'.
If you are not using readme checkbox on the finish page, you can use it to perform whatever action you want:
Function finishpageaction CreateShortcut "$desktop\foo.lnk" "$instdir\foo.exe" FunctionEnd !define MUI_FINISHPAGE_SHOWREADME "" !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED !define MUI_FINISHPAGE_SHOWREADME_TEXT "Create Desktop Shortcut" !define MUI_FINISHPAGE_SHOWREADME_FUNCTION finishpageaction
An alternate, and the simplest way to allow the user to add a desktop icon is to create a custom Section that does it. The user can then choose to add the shortcut in the "features" page of the installer and you don't have to do heavy modifications of the UI.
Section "Desktop Shortcut" SectionX SetShellVarContext current CreateShortCut "$DESKTOP\Your Program.lnk" "$INSTDIR\YourProgram.exe" SectionEnd
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With