C# 如何获得操作系统架构(x86 或 x64)?

编程入门 行业动态 更新时间:2024-10-14 06:19:44
本文介绍了C# 如何获得操作系统架构(x86 或 x64)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

可能的重复:如何使用 检测 Windows 64 位平台?

如何使用 .NET 2.0 检索操作系统架构(x86 或 x64)?

How can I retrieve the operating system architecture (x86 or x64) with .NET 2.0?

我还没有找到任何在 Google 上获取操作系统架构的好方法.我发现的是如何判断进程是 32 位还是 64 位.

I have not found any good method to get the OS architecture on Google. What I found was how to tell whether the process is 32-bit or 64-bit.

如果在 .NET 2.0 中找不到任何信息,请告诉我.:)

If there isn't anyway to find out in .NET 2.0 please tell me. :)

推荐答案

不是重复问题中接受的答案,但我会这样做:

Not the accepted answer in the duplicate question, but this is how I'd do it:

使用 GetEnvironmentVariable 查找 PROCESSOR_ARCHITEW6432 变量.如果它不存在,则您必须运行 32 位:

Use GetEnvironmentVariable to look for the PROCESSOR_ARCHITEW6432 variable. If it doesn't exist, you must be running 32bit:

bool is64bit = !string.IsNullOrEmpty( Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432"));

更多推荐

C# 如何获得操作系统架构(x86 或 x64)?

本文发布于:2023-11-11 05:39:17,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1577534.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何获得   架构   操作系统

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!