installation - 在安装文件中创建自定义可执行名称

标签 installation inno-setup

我希望在我的 InnoSetup 中允许客户安装两个程序之一或同时安装两个程序。

我制作了额外的选择面板,用户可以在其中检查他想要安装的内容,但我有以下问题

  1. 如何更改硬编码的 AppName?
  2. 如何动态判断程序安装位置?

    例如默认安装目录是 > Program Files\Program 1 如何将其更改为 Program Files\Program 2

  3. 如何更改 UninstallDisplayIcon?

    当前 UninstallDisplayIcon={app}\program1.exe

    如何更改它取决于选择的设置:UninstallDisplayIcon={app}\program2.exe


当前配置(来自评论):

[Run]
Filename: {app}\{#MyAppExeName};
Description: {cm:LaunchProgram,{#MyAppName}};
Flags: nowait postinstall skipifsilent

其中 MyAppExeName 当前是在文件开头定义的常量。

我的问题是如何做这样的事情:

[Run]
Filename: {app}\MYFUNCTIONFROMCODESECTION_THAT_WILL_RETURN_NAME;
Description: {cm:LaunchProgram,{#MyAppName}};
Flags: nowait postinstall skipifsilent

最佳答案

如何在运行时更改 AppName 指令值?

无法更改 AppName运行时的指令值,因为它是在安装程序的初始化时评估的。

如何有条件地指定安装文件目的地?

为此,您可以使用 {code:...}脚本常量。例如:

[Files]
Source: "MyApp.exe"; DestDir: "{code:GetMyAppDestDir}"

[Code]
function GetMyAppDestDir(Value: string): string;
begin
  Result := '<Here return the path where the file should be installed...>';
end;

如何在运行时更改 UninstallDisplayIcon 指令值?

为此,您还可以使用 {code:...}脚本常量。例如:

[Setup]
UninstallDisplayIcon={code:GetUninstallDisplayIcon}

[Code]
function GetUninstallDisplayIcon(Value: string): string;
begin
  Result := '<Here return the path of the icon to be used for uninstaller...>';
end;

关于installation - 在安装文件中创建自定义可执行名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23084473/

相关文章:

java - 如何让 javafx 14 编译并运行?

installation - 使用 CreateAppDir=no 且 PrivilegesRequired=lowest 运行安装程序时“访问被拒绝”

inno-setup - 如何替换或消除卸载过程中的InnoSetup 'Are you sure'提示

inno-setup - 如何覆盖 Inno Setup 中的函数?

web-applications - 如何将 Web 应用程序部署到桌面?

为在另一台服务器上注册域的站点安装 SSL 证书

windows - Inno Setup 用户主页路径

java - 我可以使用 Inno Setup 为 Java 应用程序创建独立的 .exe 安装程序吗?

c++ - 设置 Netbeans 8.0.2 以与 Qt 5.4 一起使用

.net - 如何在Windows Server 2008 R2上安装ASP.net MVC 2?