确定 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
Determining 64-bit vs. 32-bit Windows
提问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
回答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。