No announcement yet.

NSIS CreateShortcut- Icon not visible to other users on same PC

  • Filter
  • Time
  • Show
Clear All
new posts

  • NSIS CreateShortcut- Icon not visible to other users on same PC

    Hi, I am using nsis to create an installer for my java application (.jar) and I have 2 questions regarding Shortcut icons.

    The installer that my nsis script creates successfully installs my application on user PC's and creates a shortcut to the application in the Start Menu. My first question is something I have noticed recently.
    On some PC's [including my own], the shortcut is created and the icon (.ico) image is displayed alongside it perfectly. However, some users have mentioned that the shortcut in the Start Menu on their PC's still has the default java .jar file icon next to the shortcut link. Does anyone know why this could be happening ?

    My second question is this:
    If my application is installed by an admin user of a PC and other users then login and try to use it, they can see the Shortcut to the application but in these cases, they see no icon next to the shortcut [not even the java .jar file icon] ? It seems as if the installer is unable to set the icon for all users [even though my nsis script uses "SetShellVarContext all" before creating the shortcut]. I would'vew thought it would at least default to the java .jar file icon.

    If anyone has any suggestions or feedback on how to fix these issues, please let me know soon. Thanks.

  • #2
    When creating a shortcut it is important that the target and the .ico exists before you create the shortcut.

    The second issue sounds like a permission issue.

    InstallDir "$ProgramFiles\MyApp"

    SetShellVarContext all
    SetOutPath $instdir
    File MyApp.jar
    File MyApp.ico
    CreateShortcut "$smprograms\myapp.lnk" "c:\whatever\java.exe" '-jar "$instdir\MyApp.jar"' "$instdir\MyApp.ico" 0
    IntOp $PostCount $PostCount + 1