[英]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.