Skip to content
⌘ NSIS Forum Archive

Creating Desktop Shortcut - Success!

8 posts

n4gix#

Creating Desktop Shortcut - Success!

I have to admit I was very pleasantly surprised at just how easy it was for me to add a Desktop Shortcut to a "Menu Manager" program one of my coders wrote.

I just needed to add a few lines to the end of my existing installer script(s), since he already included an .ico file in his MM utility program:


Section "Start Menu Shortcuts"
SetOutPath "$INSTDIR\Milviz"
CreateShortCut "$DESKTOP\MV_MM.lnk" "$INSTDIR\Milviz\MV_MM.exe" ""
SectionEnd
I wish everything I had to do was that easy! 😎
MSG#
If you want to use the ico file, you might want to set that as the shortcut's icon. Now you're just using the first icon in the exe.

Also, maybe Section "Desktop shortcut"?
alibabavl64#
Hy,
i wroted in code:

Section -AdditionalIcons
SetOutPath $INSTDIR
;[...]-few icons here in start->programms..

CreateShortCut "$DESKTOP\MyProg.lnk" "$INSTDIR\MyProg.exe" "$INSTDIR\MyIcon.ico"
SectionEnd

The shortcut' icon is not MyIcon.ico, is "MyProg.exe" 's icon.
MyIcon.ico exist in C:\MyProgLocation.

RightClick->Properties on MyProg.lnk

In Target Line appear:

"C:\MyProgLocation\MyProg.exe" C:\MyProgLocation\MyIcon.ico

Exactly like i wroted, first with " " and the second without " ".

Where is my mistake?
In my oppinion command is ok..
Anders#
And your opinion is wrong of course.

Go back to the documentation and study the CreateShortcut parameters. You need to use "" for parameters you don't want to set...
alibabavl64#
I need create in NSIS a shortcut with this properties:
1. Run as administrator = used ShellLink and is OK.
2. Run in Compatibility Mode XP SP3. Is possible with NSIS or a plugin?
That because on W7+ the programm give few errors. In XP SP3 compat.mode work well
Thank you.
Anders#
Originally Posted by alibabavl64 View Post
2. Run in Compatibility Mode XP SP3. Is possible with NSIS or a plugin?
This information is stored in the registry, not in the .lnk.

You are not supposed to set those entries in a installer, you should fix the application. See https://web.archive.org/web/20190109...1-00/?p=14643/