运行程序System32下,而不是Syswow64资料从MINGW时启动 [英] Running System32 programs instead of SysWOW64 when launching from MINGW
问题描述
我试图创建一个shell脚本文件,我从minggw启动EXE文件(从混帐bash的使用)
I'm trying to create EXE files from a shell script file I'm launching from minggw (used from git bash)
我的问题是,当我运行以下命令:
My problem is when I run these commands:
C:/Windows/system32/iexpress.exe //N C:\\git\\install_64bitWindows.SED
C:/Windows/SysWOW64/iexpress.exe //N C:\\git\\Install_32bitWindows.SED
他们总是最后援引SysWOW64中找到MakeCab(这将创建一个32位的.exe)
反正对我来说,从SYSTEM32推出一个新的CMD对我来说,能够让我的64位的.exe?
They always end up invoking the makecab in SysWOW64 (which creates a 32 bit .exe) Is there anyway for me to launch a new cmd from system32 for me to be able to make my 64 bit .exe?
推荐答案
由于您正在运行从32位可执行程序的命令,操作系统自动重定向到System32下的Syswow64资料你,与旧的($ P $兼容性的原因对64位)可执行文件(这样一来,他们就会加载它们的依赖关系的正确路径)。
Because you're running the command from a 32-bit executable, the OS redirects System32 to SysWOW64 for you automatically, for compatibility reasons with old (pre-64-bit) executables (this way, they will load their dependencies from the correct path).
要绕过重定向,您可以运行%WINDIR%\\ sysnative \\
,它会自动重定向到真正的System32下你的可执行文件:
To bypass the redirection, you can run your executable from %windir%\sysnative\
, which will automatically redirect to the "real" System32:
%WINDIR%\\ sysnative \\ IEX press.exe //ñC:\\\\ \\\\的git install_64bitWindows.SED
有关完整说明,请参见:<一href=\"http://www.tipandtrick.net/how-to-sup$p$pss-and-bypass-system32-file-system-redirect-to-syswow64-folder-with-sysnative/\" rel=\"nofollow\">http://www.tipandtrick.net/how-to-sup$p$pss-and-bypass-system32-file-system-redirect-to-syswow64-folder-with-sysnative/
For full explanation, see: http://www.tipandtrick.net/how-to-suppress-and-bypass-system32-file-system-redirect-to-syswow64-folder-with-sysnative/
如果您还想运行32位可执行文件,使用
If you want to also run your 32-bit executable, use
%WINDIR%\\ SYSTEM32 \\ IEX press.exe //ñC:\\\\ \\\\的git install_32bitWindows.SED
,因为这将与32位和64位操作系统环境兼容。
as this will be compatible with both 32-bit and 64-bit OS environments.
要检测,如果你是一个32位或64位= OS,检查(误导命名)环境变量 PROCESSOR_ARCHITECTURE
。这将是 86
为32位和 AMD64
对于64位操作系统。
To detect if you're on a 32-bit or 64=bit OS, check the (misleadingly named) environment variable PROCESSOR_ARCHITECTURE
. It will be "x86
" for a 32-bit and "AMD64
" for a 64-bit OS.
全部放在一起:
对于Windows CMD脚本:
For a Windows CMD script:
if "%PROCESSOR_ARCHITECTURE%"=="x86" (
%windir%\system32\iexpress.exe //N C:\git\install_32bitWindows.SED
) else (
%windir%\sysnative\iexpress.exe //N C:\git\install_64bitWindows.SED
)
对于庆典
脚本:
if [ "$PROCESSOR_ARCHITECTURE" = "x86" ]; then
$WINDIR/system32/iexpress.exe //N C:\\git\\install_32bitWindows.SED
else
$WINDIR/sysnative/iexpress.exe //N C:\\git\\install_64bitWindows.SED
fi
(需要注意的是,在bash,变量名是区分大小写,即使在Windows上)。
(Note that, in bash, variable names are case sensitive, even on Windows).
这篇关于运行程序System32下,而不是Syswow64资料从MINGW时启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!