确定 64 位与 32 位 Windows

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/191873/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 11:26:09  来源:igfitidea点击:

Determining 64-bit vs. 32-bit Windows

windowsvisual-studio-200564-bit32-bit

提问by LeeMobile

I'd like to configure visual studio 2005 to copy .dll's based on whether the OS is 64-bit or 32-bit during a build.

我想根据操作系统是 64 位还是 32 位在构建过程中将 Visual Studio 2005 配置为复制 .dll。

I do not want to specify what the platform target is.

我不想指定平台目标是什么。

My first attempt was to use a batch file to lookup the Windows version, but some 32-bit and 64-bit versions of Windows share the same version number.

我的第一次尝试是使用批处理文件来查找 Windows 版本,但某些 32 位和 64 位版本的 Windows 共享相同的版本号。

Anyone know of any way to check this?

任何人都知道任何方法来检查这个?

Thanks!

谢谢!

采纳答案by Jon Tackabury

You should be able to read the environment variable %PROCESSOR_ARCHITECTURE%. Here is some great information on it.

您应该能够读取环境变量 %PROCESSOR_ARCHITECTURE%。这里有一些关于它的重要信息。

http://blogs.msdn.com/david.wang/archive/2006/03/26/HOWTO-Detect-Process-Bitness.aspx

http://blogs.msdn.com/david.wang/archive/2006/03/26/HOWTO-Detect-Process-Bitness.aspx

回答by Re0sless

Check out isWow64, I think that shopuld give you what you are after.

看看isWow64,我认为 shopuld 给你你所追求的。

Determines whether the specified process is running under WOW64.

确定指定的进程是否在 WOW64 下运行。

回答by Erik Knowles

Jon's link is a total hack because it relies upon no new processor architectures being added.

Jon 的链接完全是黑客攻击,因为它不依赖于添加新的处理器架构。

See: http://support.microsoft.com/kb/556009for the "official" batch file method.

有关“官方”批处理文件方法,请参见:http: //support.microsoft.com/kb/556009