Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt Installer Framework : Create shortcut with argument

Does anyone know how to add an argument to a shortcut created by QT IFW? I need the exe it launches to be passed an argument.

Here's what works (with no argument):

component.addOperation( "CreateShortcut",
    "@TargetDir@/MyApp.exe",
    "@StartMenuDir@/@[email protected]",
    "workingDirectory=@TargetDir@",
    "iconPath=@TargetDir@/MyApp.exe",
    "iconId=0");

I want the exe to get something like -c passed to it. I've tried a few approaches, but am not having any luck.

like image 738
BuvinJ Avatar asked Oct 12 '25 19:10

BuvinJ


1 Answers

Qt Installer framework documentation is very poor, but you can read in operations the following: "CreateShortcut" filename linkname [arguments]

Creates a shortcut from the file specified by filename to linkname. On Windows, this creates a .lnk file which can have arguments. On Unix, this creates a symbolic link.

So do it in that way:

component.addOperation("CreateShortcut", "@TargetDir@/Appname.exe", "@DesktopDir@/Appname.lnk", "-param");

Result in lnk target element: C:\YourAppDirectory\Appname.exe -param

EDIT: Your case works as well for me:

component.addOperation( "CreateShortcut","@TargetDir@/Appname.exe","@StartMenuDir@/@‌​[email protected]", "-param", "workingDirectory=@TargetDir@",  "iconPath=@TargetDir@/Appnam‌​e.exe","iconId=0");

with -param as the last argument too.

like image 159
Macias Avatar answered Oct 14 '25 22:10

Macias