7

How can I create desktop shortcuts for all user while installing a package?

Ilya
  • 5,533
  • 2
  • 29
  • 57
vijay
  • 679
  • 2
  • 7
  • 15

2 Answers2

10

NSIS supports several of the common/shared special folders:

SetShellVarContext all
CreateShortcut "$desktop\myapp.lnk" "$instdir\myapp.exe"

This code assumes you are elevated...

Community
  • 1
  • 1
Anders
  • 97,548
  • 12
  • 110
  • 164
  • This works for me on Windows 10. However, it doesn't seem to do the trick for a similar shortcut in the 'start programs' folder (`$SMPROGRAMS`). – florisla Jun 06 '16 at 11:59
  • In MUI2, you have to `!insertmacro MUI_STARTMENU_WRITE_BEGIN Application` to set $SMPROGRAMS. When you are done `_END` – rickfoosusa Mar 15 '21 at 18:32
2

With !include NTProfiles.nsh [1] you can create a shortcut in the folder "${ProfilePathAllUsers}\Desktop".

[1] - http://nsis.sourceforge.net/NT_Profile_Paths

robert
  • 3,484
  • 3
  • 29
  • 38
  • Hi Robert.. Thanks for the solution.. but it seems to b not working in my package maker 1.1.. Is there any constraints bcoz of version.? I adden NTProfiles.nsh in Include Folder and given the path as u mentioned... Thanks.. – vijay Sep 22 '11 at 07:01
  • 1
    This code uses undocumented registry values! NSIS has native support for the shared desktop folder so this kind of thing is not required nor recommended! – Anders Jul 11 '12 at 04:09