Search code examples
nsis

How to create a shortcut to run my application from start menu?


I have written nsis script.Using NSIS, how do I create StartMenu shortcut to run my application through this shortcut folder in Windows?. Following code working fine for opening folder using shortcut folder in STARTMENU.

CreateShortcut "$smprograms\my app\my shortcut.lnk" "c:\path\to\folder"

My question is,

Is there any way to run my application directly through this shortcut folder in STARTMENU?

Can anyone help me?


Solution

  • Here is an extract of an installer that creates both start and uninstall (if you generate the uninstaller while installing your program) shortcuts :

    CreateDirectory '$SMPROGRAMS\${Company}\${AppName}'
    CreateShortCut '$SMPROGRAMS\${Company}\${AppName}\${AppName}.lnk' '$INSTDIR\${AppExeName}' "" '$INSTDIR\${AppExeName}' 0
    CreateShortCut '$SMPROGRAMS\${Company}\${AppName}\Uninstall ${AppName}.lnk' '$INSTDIR\${AppUninstaller}' "" '$INSTDIR\${AppUninstaller}' 0
    

    The Company, AppName, AppExeName and AppUninstaller are defined once somewhere else in the script, so that some portions of the script are generic enough to be reused in several installers.