Qt 安装程序框架 : Create shortcut with argument

标签 qt installation

有谁知道如何向 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@/Appnam‌​e.exe","iconId=0");

也将 -param 作为最后一个参数。

关于Qt 安装程序框架 : Create shortcut with argument,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46040537/

相关文章:

C++ pthread 和 Qt

sql-server - SQL Server 2014 安装卡住(挂起)或需要很长时间才能完成

installation - Ocaml OPAM 是否检测先前安装的 Ocaml 软件包?

c++ - 如何为QPushButton 重新添加按下/单击效果?

c++ - 如何使用十六进制格式更改容器的背景颜色?

c++ - 如何在 Qt、GCD 风格的给定线程中执行仿函数或 lambda?

C++ - Qt - Visual Studio 2010 - 具有图形用户界面和控制台的应用程序

c# - 如何向用户显示安装程序

c++ - 将依赖项添加到安装项目 Win32 应用程序 Visual Studio

Joomla 3.0 安装数据库创建问题