简体   繁体   English

使用NSIS将32位和64位安装程序合并为一个安装程序

[英]Merge 32bit and 64bit installer into one installer using NSIS

I have created a simple installer using NSIS. 我使用NSIS创建了一个简单的安装程序。 I want that the installer should detect the OS that a client is using.If a client is using a 32-bit OS then all the files should be copied to Program Files(32 bit) folder or else if he/she is using a 64-bit OS, all the files should be copied to 64-bit.Can anyone help me how to figure this out.. 我希望安装程序能够检测到客户端正在使用的操作系统。如果客户端使用的是32位操作系统,则所有文件都应复制到Program Files(32位)文件夹,否则,如果他/她使用的是64位操作系统位操作系统,所有文件都应复制到64位。任何人都可以帮助我解决这个问题。

Thanks 谢谢

Same as above (don't forget to include LogicLib.nsh and x64.nsh) 与上面相同(不要忘了包含LogicLib.nsh x64.nsh)

Function .onInit

    ${If} ${RunningX64}
        StrCpy $INSTDIR "$PROGRAMFILES64\myProduct"
    ${Else}
        StrCpy $INSTDIR "$PROGRAMFILES\myProduct" ; $PROGRAMFILES32 also works
    ${EndIf}

FunctionEnd

Optionally, you can also set the registry view (see SetRegView ) (可选)您还可以设置注册表视图(请参阅SetRegView

Following code will do the task. 以下代码将完成任务。

!include "x64.nsh"
.
.
.
.
var copyDir

section ""

${If} ${RunningX64}
strcpy $copyDir "C:\\Program Files(x64)\\Foo"

${else}
strcpy $copyDir "C:\\Program Files\\Foo"
sectionend

Although if its just about detecting the Program Files directory, I think $ProgramFiles will automatically detect the default Program Files directory according to the OS bit. 尽管如果只是检测Program Files目录,我认为$ProgramFiles会根据OS位自动检测默认的Program Files目录。

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

相关问题 如何使用Installshield 2010创建仅32位或64位安装程序? - How to create 32bit or 64bit only installer with Installshield 2010? 一个Windows安装程序中的32位和64位程序集 - 32 and 64 bit assemblies in one windows installer 使用一个NSIS安装程序可以在32位操作系统上安装32位二进制文​​件,在64位操作系统上安装64位二进制文​​件吗? - Use one NSIS installer to install 32-bit binaries on 32-bit OS and 64-bit binaries on 64-bit OS possible? 无法使用VS 2010创建64位MSI安装程序 - Unable to create 64bit msi installer using VS 2010 使安装程序同时支持64位和32位 - Make Installer for Both 64 and 32 bit 在64位Windows上安装32位或64位应用程序有什么区别? - What's the difference between installing 32bit or 64bit apps on a 64bit Windows? 在64位和32位安装程序(高级安装程序)上的Visual Studio Crystal Reports - Visual Studio Crystal Reports on 64 and 32 bit installer (advance installer) 32位MSI:将64位应用程序的快捷方式目标路径转换为32位路径 - 32bit MSI: Converting shortcut target path of 64bit app to 32 bit Path 从32位安装程序写入64位注册表 - Writing to 64-bit registry from 32-bit installer 如何创建测试32位和64位Windows的安装程序条件 - How to create an installer condition that test for 32 and 64 bit Windows
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM