Skip to content
⌘ NSIS Forum Archive

Create Shortcut

21 posts

duermer#

Create Shortcut

Hi,

Could somebody write me, how the line must be to create a shortcut on the desktop.

Sincerly Patrick Hennig
VegetaSan#
Go to the NSIS Folder on your Computer and then Look for a Map called Examples look for "BigTest.nsi"

VERY USEFULL 🙂

Icon "THE LOCATION AND NAME OF THE FILE.ico"
Joost Verburg#
That is not what he means.

To add an icon to a shortcut:

CreateShortcut "myshortcut.lnk" "myapp.exe" "" "myappwithicon.exe" 0
Comm@nder21#
clearer:
CreateShortcut "shortcutname.lnk" "application.exe" "commandline parameters" "icon-file.ico/.dll/.exe" "icon-index (usually 0)" "mode to open (normal, maximized, minimized)" "description of this shortcut"
tderouin#
FYI, keyboard_shorcut comes before descrption.

At any rate, you should check out the CreateShortcut definition if you have questions in the documentation.
michaelmross#
The documentation is inadequate and lacks examples. All it says is: "The icon used for the shortcut is 'icon.file,icon_index_number'" That doesn't even clarify if the file to specify is the source file or the target file. And there is not a single example of this in the \Examples either.

Neither of these works:

CreateShortCut "$SMPROGRAMS\TaskTracker\TaskTracker Help.lnk" "$INSTDIR\TaskTracker Help.url" "help.ico" "0" 0 SW_SHOWMAXIMIZED

CreateShortCut "$SMPROGRAMS\TaskTracker\TaskTracker Help.lnk" "$INSTDIR\TaskTracker Help.url" "$INSTDIR\help.ico" "0" 0 SW_SHOWMAXIMIZED
Comm@nder21#
HELL, is this documentation really so hard to understand?******?
CreateShortCut link.lnk target.file [parameters [icon.file [icon_index_number [start_options [keyboard_shortcut [description]]]]]]
use this code:
CreateShortCut "$SMPROGRAMS\TaskTracker\TaskTracker Help.lnk" "$INSTDIR\TaskTracker Help.url" "" "$INSTDIR\help.ico" "0" "SW_SHOWMAXIMIZED"
and PLEASE look few times about it to get the mistakes you made, for learning 🙂
michaelmross#
Actually there is one other very critical - very obvious thing, I guess - completely missing from the doc. But it took me a long time to cotton on: You have to install the icon that you want the program shortcut to use.

i.e.

Section "MainSection" SEC02
. . .
File "help.ico"
Davion#
You don't really install the Icon, you just put it on the target system

Every Icon you want to use has to be anywhere, and if you are using a non windows icon, you should "install" it

well, you can include Icons in executables (like done in many Exefiles you can see on your System)

so if you are creating a shortcut to this, the icon of the exe should be used, but I'm not sure if this is working on every System - its better to specify the icons exactly

greetz Dave
bubu#
don't understand why

hi. i wanted to create a desktop shortcut for an app that will have in the target place an url.
this is what i wrote:

CreateShortCut "$DESKTOP\Launch.lnk" "C:\Program Files\Launch\Launch.exe" "C:\Program Files\Internet Explorer\iexplore.exe" /p="http://yahoo.com" "" "0" "SW_SHOWMAXIMIZED"

but when compiling i get this error :"error in script on line.."

what am i doing wrong? can anyone help me, pls? thx
Anders#




Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.
bubu#
well...

i have looked over the links..i knew them. the thing is that when compiling, nsis does not take both paths....only the first one... < "C:\Program Files\Launch\Launch.exe"> and i need the second one too. i have to find a way to keep them both. and i am looking for answers since this morning and my current time is 2 in the afternoon 🙂)))
...:-??
Anders#
No, you did not check the links, if you had done that, you would know that links to internet url's are not shortcuts, but a .ini file
bubu#
i understand what u are saying. but i think i didn't explained very clear what is my problem.
through a program i have to connect to an url. in the target of the shortcut.. this is what i have to have :
""C:\Program Files\Launch\Launch.exe" "C:\Program Files\Internet Explorer\iexplore.exe" /p="http://rz.bubu.fr" /a=1"

"/p" and "/a=1" are parameters that i have to pass to the program (ex. Launch.exe )that then, and only then can access the page.

*(the http is not real, it just to for the example)
Afrow UK#
`"C:\Program Files\Launch\Launch.exe" "C:\Program Files\Internet Explorer\iexplore.exe" /p="http://rz.bubu.fr" /a=1`

Stu
bubu#
just wanted to say thank you!
it was as u said...i wouldn't have thought of those different kind of quotes. (just needed to play with them a little)

CreateShortCut "$DESKTOP\app.lnk" "$PROGRAMFILES\App\App.exe" `"$PROGRAMFILES\Internet Explorer\IEXPLORE.exe" /e="http://xy.bubu.fr" /c=4` "$PROGRAMFILES\Internet Explorer\IEXPLORE.exe"


maybe this will help somebody too.
Thank you again.
Afrow UK#
Yes " ' and ` can all be used.
I always use ` for outer quotations for the reason that it is used the least (and won't result in compile errors).

Stu