How can I get system type by c# code? for example: 32 bit. (win 7 Ent)
Asked
Active
Viewed 3,412 times
3 Answers
5
Environment.Is64BitOperatingSystem
Environment.Is64BitProcess
Enviromment.OSVersion
And for OSVersion
look in this for constructing OS name - OS version realations:
Determine OS using Environment.OSVersion
and this contains the different OS name, OS version relations:
http://www.nirmaltv.com/2009/08/17/windows-os-version-numbers/
Lastly, if you don't want to do all that code yourself, you could use this code (which will get you edition etc. but is not based on Environment
):
http://www.csharp411.com/determine-windows-version-and-edition-with-c/

Community
- 1
- 1

Lasse Espeholt
- 17,622
- 5
- 63
- 99
2
Checkout the IntPtr.Size property:
The value of this property is 4 on a 32-bit platform, and 8 on a 64-bit platform.

Darin Dimitrov
- 1,023,142
- 271
- 3,287
- 2,928
-
1No, this will give whether the process itself is running in 32 bit or 64 bit. Processes can run in 32 bit on 64 bit platforms. Which equals to `Environment.Is64BitProcess`. – Lasse Espeholt Aug 23 '10 at 08:04