windows 32 位 NSIS 是否可以启动 64 位程序?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1700525/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is it possible for 32 bit NSIS to launch a 64 bit program?
提问by Benj
I'm porting a windows program from 32 -> 64 bit. It has a 32 bit installer which is written using NSIS. Can I launch one of my new 64 bit exes using the 32 bit NSIS installer? I don't think there is a 64 bit version of NSIS...
我正在从 32 -> 64 位移植 Windows 程序。它有一个使用 NSIS 编写的 32 位安装程序。我可以使用 32 位 NSIS 安装程序启动我的新 64 位 exe 之一吗?我不认为有 64 位版本的 NSIS ......
回答by saschabeaumont
Sure you can, NSIS doesn't impose any restrictions and what's really nifty about NSIS is if you have both 32 and 64 bit versions of your app, you can do a combined installer, and install the required files on a per-architecture basis. e.g.
当然可以,NSIS 没有强加任何限制,而且 NSIS 的真正妙处在于,如果您同时拥有 32 位和 64 位版本的应用程序,您可以执行组合安装程序,并在每个架构的基础上安装所需的文件。例如
!include "x64.nsh"
${If} ${RunningX64}
File ..\x64\blah.exe
${Else}
File ..\x86\blah.exe
${EndIf}
回答by Shay Erlichmen
NSIS uses two Win32 APIs to execute processes ShellExecute
(thru ExecShell
) and CreateProcess
(thru Exec
and ExecWait
), both of them can run 64 bit process (x64) from NSIS 32 bit process (as long as you're running on 64 bit OS).
NSIS 使用两个 Win32 API 来执行进程ShellExecute
(thru ExecShell
) 和CreateProcess
(thruExec
和ExecWait
),它们都可以从 NSIS 32 位进程运行 64 位进程 (x64)(只要您在 64 位操作系统上运行)。
回答by sonyisda1
For executing processes needing 64-bit operation I found the default NSIS execution would not automatically run in 64-bit mode. I encountered this when trying to run DISM to install .NET Framework 3.5. DISM would error out stating:
为了执行需要 64 位操作的进程,我发现默认的 NSIS 执行不会在 64 位模式下自动运行。我在尝试运行 DISM 以安装 .NET Framework 3.5 时遇到了这个问题。DISM 会出错,说明:
"You cannot service a running 64-bit operating system with a 32-bit version of DISM."
“您无法使用 32 位版本的 DISM 为正在运行的 64 位操作系统提供服务。”
To resolve I added needed to add DisableX64FSRedirection
before the call that needs 64-bit operation. See below for example:
为了解决我添加需要DisableX64FSRedirection
在需要 64 位操作的调用之前添加。参见下面的例子:
${If} ${RunningX64}
${DisableX64FSRedirection}
DetailPrint "Disabling Windows 64-bit file system redirection"
${EndIf}
nsExec::ExecToStack 'Dism.exe /Online /Enable-Feature /FeatureName:NetFx3'
${If} ${RunningX64}
${EnableX64FSRedirection}
DetailPrint "Re-enabling Windows 64-bit file system redirection"
${EndIf}
回答by K. Santosh
just to add more descriptive
只是为了添加更多描述性
have a look, http://www.autoitscript.com/forum/index.php?showtopic=44048
看看吧, http://www.autoitscript.com/forum/index.php?showtopic=44048
回答by Stoker
Well.. there are some restrictions here.. for instance, try run odbcconf.exe to install a driver. I have not been able to figure out a way to make that come in as a 64bit entry. Same way I think as if you (in a 64bit system) start "powershell x86" as admin, then run cmd and odbcconf from there - no easy way to get around it that I can find, making odbcconf do x64
嗯.. 这里有一些限制.. 例如,尝试运行 odbcconf.exe 来安装驱动程序。我一直无法想出一种方法来将其作为 64 位条目输入。我认为就好像您(在 64 位系统中)以管理员身份启动“powershell x86”,然后从那里运行 cmd 和 odbcconf - 没有简单的方法可以解决它,我可以找到它,使 odbcconf 执行 x64