2017-09-04 226 views
0

有谁知道如何将参数添加到由QT IFW创建的快捷方式? 我需要它启动的exe文件来传递参数。Qt安装程序框架:使用参数创建快捷方式

这里是工作(不带参数):

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

我想要的exe要达到这样的-c传递给它。我尝试了一些方法,但没有任何运气。

回答

1

的Qt框架的安装文档非常差,但你可以在operations阅读以下内容: "CreateShortcut" filename linkname [arguments]

创建从文件名LINKNAME指定的文件的快捷方式。在Windows上,这会创建一个可以有参数的.lnk文件。在Unix上,这会创建一个符号链接。

所以做这种事儿: C:\YourAppDirectory\Appname.exe -param

编辑:在LNK目标元素

component.addOperation("CreateShortcut", "@[email protected]/Appname.exe", "@[email protected]/Appname.lnk", "-param"); 

结果 你的情况下工作,以及对我来说:

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

-param也是最后一个参数。

+0

如果可能,请对此进行测试。这不适合我。当我这样做时,它返回“意外标记”。请注意,目前我确实传递了更多参数,但它们都是“命名的”并且具有特定的用途。 – BuvinJ

+0

@BuvinJ适用于我:'component.addOperation(“CreateShortcut”,“@ [email protected]/Appname.exe”,“@ StartMenuDir @/@ ProductName @ .lnk”,“-param”,“workingDirectory = @ TargetDir @ “,\t”iconPath = @ TargetDir @/Appname.exe“,”iconId = 0“);'你究竟在哪里得到错误? – Macias

+0

嗯......抱起来。也许我在其他地方有一个错字。 – BuvinJ

相关问题