可能重复:
How to detect Windows 64 bit platform with .net?Environment.GetEnvironmentVariable检查操作系统版本32位/ 64位
项目:C#0.5
描述:代码检查是否底层机器是64位或32位操作系统。 返回值:该代码始终返回null
值。 为什么?因为它是返回变量未设置
if (8 == IntPtr.Size || (!String.IsNullOrEmpty(Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432"))))
{
return Environment.GetEnvironmentVariable("SysWOW64");
}
return Environment.GetEnvironmentVariable("system32");
有什么理由,为什么你不能使用'Environment.Is64BitOperatingSystem'或'Environment.Is64BitProcess' ? – LukeH
问题重复 –