简体   繁体   English

Inno Setup:在带有 {pf} 的 32 位/64 位系统上使用“Program Files”目录

[英]Inno Setup: Use “Program Files” directory on both 32bit/64bit systems with {pf}

The constant {pf} is the directory of常量 {pf} 是目录

C:\\Program Files C:\\程序文件

for 32bit systems and对于 32 位系统和

C:\\Program Files (x86) C:\\程序文件 (x86)

for 64bit systems.对于 64 位系统。

However I want to use the directory但是我想使用目录

C:\\Program Files C:\\程序文件

for both, 32 and 64bit systems.对于 32 位和 64 位系统。 How can I achieve this?我怎样才能做到这一点?

Use a scripted constant like:使用 脚本常量,如:

[Setup]
DefaultDirName={code:GetProgramFiles}\My Program
[Code]

function GetProgramFiles(Param: string): string;
begin
  if IsWin64 then Result := ExpandConstant('{pf64}')
    else Result := ExpandConstant('{pf32}')
end;

Though this approach should only be used, if you generate binaries for the respective platform on the fly.虽然这种方法应该只使用,如果你在运行中为相应的平台生成二进制文件。 Like in your case, if understand correctly, you compile the Java binaries for the respective architecture.就像你的情况一样,如果理解正确,你就可以为各自的体系结构编译 Java 二进制文件。


If you have a separate 32-bit and 64-bit binaries in the installer, use a script like:如果安装程序中有单独的 32 位和 64 位二进制文​​件,请使用如下脚本:

[Files]
Source: "MyDll32.dll"; DestDir: "{pf32}\My Program"; Check: not IsWin64
Source: "MyDll64.dll"; DestDir: "{pf64}\My Program"; Check: IsWin64

See also:另见:

If you are using a single installer for both 64 and 32 bit installs then you should be using the ArchitecturesInstallIn64BitMode Setup Directive.如果您为 64 位和 32 位安装使用单个安装程序,那么您应该使用ArchitecturesInstallIn64BitMode安装指令。 This will change {pf} and other scripted constants to be their 64 bit version when installing on a 64 bit system, and their 32 bit versions when installing on a 32 bit system.这将在 64 位系统上安装时将 {pf} 和其他脚本常量更改为 64 位版本,在 32 位系统上安装时将其更改为 32 位版本。

You will obviously also want to use a Check as in Martin's example to make sure you are only installing the correct binaries.您显然还想使用 Martin 示例中的 Check 来确保您只安装了正确的二进制文件。

Ex:例如:

#define MyAppName "MyAwesomeApp"
[Setup]
ArchitecturesInstallIn64BitMode=x64
AppName={#MyAppName}
DefaultDirname={pf}\{#MyAppName}

[Files]
Source: "MyApp_32bit.exe"; DestDir: "{app}"; Check not Is64BitinstallMode;
Source: "MyApp_64bit.exe"; DestDir: "{app}"; Check Is64BitinstallMode;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 32位操作系统上的32位程序和64位操作系统上的32位程序有什么区别? - Whatis the difference between a 32bit program on a 32bit OS and 32bit program on a 64bit OS? C#Windows程序将文件写入“ sysWOW64”和“程序文件(x86)”。 使用VS安装项目。 64位系统上的32位应用程序 - C# Windows Program writes files to “sysWOW64” and to “Program Files(x86)”. Using VS Setup Projects. 32bit App on 64bit System 在64位(或32位)Windows上以32位进程访问> 2,3,4GB文件 - Accessing >2,3,4GB Files in 32bit Process on 64bit (or 32bit) Windows Inno Setup以32位模式安装到SysWOW64 - Inno Setup install to SysWOW64 in 32Bit mode 我们可以使用Qt(64)生成既可以在32位窗口又可以在64位窗口上运行的应用程序吗? - can we use Qt(64) to produce an application that will work on both 32bit windows and 64bit windows? 通过 powershell 查询 32 位和 64 位注册表 - Querying via powershell both 32bit and 64bit registry VB6程序使用的32位dll在64位Win 7中不起作用 - 32bit dll used by VB6 program doesn't work in 64bit Win 7 从 32 位 c++ 程序读取 64 位注册表? - Reading 64bit registry from 32bit c++ program? 在Windows 7 64位上,一个32位程序可以访问多少地址空间? - on windows 7 64bit, how much address space can a 32bit program access? 我可以在32位Windows OS上运行64位Java程序吗 - Can I run 64bit java program on a 32bit windows os
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM