有谁知道如何向 QT IFW 创建的快捷方式添加参数? 我需要它启动的 exe 来传递参数。
这是有效的(没有参数):
component.addOperation( "CreateShortcut",
"@TargetDir@/MyApp.exe",
"@StartMenuDir@/@ProductName@.lnk",
"workingDirectory=@TargetDir@",
"iconPath=@TargetDir@/MyApp.exe",
"iconId=0");
我想让 exe 得到类似 -c
的东西传递给它。我尝试了几种方法,但没有任何运气。
最佳答案
Qt Installer 框架文档很差,但你可以阅读operations以下:
“CreateShortcut”文件名链接名[参数]
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.
那就这样吧:
component.addOperation("CreateShortcut", "@TargetDir@/Appname.exe", "@DesktopDir@/Appname.lnk", "-param");
lnk目标元素的结果:
C:\YourAppDirectory\Appname.exe -param
编辑: 你的情况对我也适用:
component.addOperation( "CreateShortcut","@TargetDir@/Appname.exe","@StartMenuDir@/@ProductName@.lnk", "-param", "workingDirectory=@TargetDir@", "iconPath=@TargetDir@/Appname.exe","iconId=0");
也将 -param
作为最后一个参数。
关于Qt 安装程序框架 : Create shortcut with argument,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46040537/