inno-setup - 如何为以前的 Inno Setup 安装自动设置 DefaultDirName?

标签 inno-setup

我之前在 Inno Setup 中的安装 (A) 的 AppID={{8ADA0E54-F327-4717-85A9-9DE3F8A6D100}。

我有另一个具有不同 AppID 的安装 (B),我想将其安装到与安装 (A) 相同的目录中。

如何自动获取 DefaultDirName?我不想使用相同的 AppID,因为当我卸载安装 (B) 并且安装 (A) 保持安装状态时,它将从注册表中删除 AppID 字符串(安装 (A) 字符串)。

你能帮我一下吗?

最佳答案

您可能需要一些代码来完成您想要的操作。您还需要一种方法来查找应用程序 A 的安装目录。这是我使用过的一些代码

[Setup]
DefaultDirName={code:GetDefaultDir}

[Code]
function GetDefaultDir(def: string): string;
var
sTemp : string;
begin
    //Set a defualt value so that the install doesn't fail.  
    sTemp := ExpandConstant('{pf}') + '\MyCompany\MyAppA';

    //We need to get the current install directory.  
    if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\MyCompany\Products\MyAppNameA',
     'InstallDir', sTemp) then
     begin
    //We found the value in the registry so we'll use that.  Otherwise we use the default 
     end;
    Result := sTemp;
end;

关于inno-setup - 如何为以前的 Inno Setup 安装自动设置 DefaultDirName?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5720475/

相关文章:

inno-setup - 如何在 Inno Setup 中使用变量\宏?

windows - 安装程序 : WIX or Inno Setup?

inno-setup - 如何使Inno Setup显示MsgBox并在指定时间后自动关闭它

inno-setup - 在 Inno Setup 中复制到剪贴板

inno-setup - 在 Inno 安装程序中使用新行显示文件中的文本

inno-setup - Inno Setup 5.5.9 中的多个 WizardSmallImageFiles

inno-setup - 创新设置: Conditional FLAGS

installshield - 在安装过程中使用 Inno Setup 删除另一个未使用 Inno Setup 安装的应用程序

inno-setup - 如何使用带参数的 exec 与正在提取的正在运行的进程进行交互

inno-setup - 如何使 Inno Setup 安装程序仅安装在服务器版本的 Windows 上