开发者

Working out version of windows [duplicate]

This question already has answers here: 开发者_StackOverflow Closed 12 years ago.

Possible Duplicate:

How to detect Windows 64 bit platform with .net?

How do you know if the operating system is x64 or x86 from a c# .net 2.0 windows applicaiton?

Also the applicaiton is 32bit.

Thanks


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"));

EDIT:

Thanks to Hans Passant for pointing out the error in using the PROCESSOR_ARCHITECTURE variable.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜