View Full Version : Creating a shortcut file in a folder

Tim Mayert
11-10-2005, 02:08 PM
Is there an easy way to create a shortcut file that points to a file that is being installed and setting a command line parameter to that shortcut. I am talking about creating the .lnk file and not an Icon that goes in the program group.

If there is a built in way to handle this then could you let me know. If not then is there an easy way to handle the creation of this file?


11-10-2005, 02:47 PM
Here we go:

AddFolderIcon( FOLDER_DESKTOP, @APP_NAME, TARGETDIR^"myapp.exe -myoptions", "", "", 0, "", REPLACE );

Additional information you may find in the help for the function "AddFolderIcon"

Tim Mayert
11-10-2005, 03:46 PM
I guess I should have mentioned that this is a Basic MSI project only, so no script.

Also I do not want to create a desktop or program folder icon, I just want to create a file link (.lnk) that will reside in the same folder as the app. If the users double clicks on this file I want the app to run in silent mode, whereas if they double click on the main .exe file then the app will run in UI mode.

So I just need to know if I can create this link file in the installdir? I can create one manually, but then if the directory of the .exe is not the same as what is in the properties of the lnk then it will not work.

So can this be done with the MSI project?


11-10-2005, 04:41 PM
Of cause you can do that! It's what the studio for. I didn't do MSI projects myself, but I open new MSI project and did it in 5 sec. Here is the steps:
- In the project go to "installation designer" tab
- Look for "Shortcuts" item and click on it
- You will se standard locations (desctop, programm menu...), but on the top of this tree you will have caption "Shortcuts"; right click on it and choose "show folder" -> "INSTALLDIR"; it will add this folder to the tree; you may choose any folder of the choise or create your own by click on "New"
- Next right click on this folder that already will appear in your tree and choose "New shortcut to preexisting file"; give the name
- And finally click on newly created shortcut and complete properties of it. Important would be: workdir; arguments; target(executable)

That's it. After installation you will get your .lnk file in this location. I forgot to mention I use DevStudio 9, but for 11 soppose to be the same stuff, may be even better :)

Tim Mayert
11-11-2005, 08:55 AM
Thanks, I did not think of that, but it looks like it will work like I want.