How to check whether the operating system is 32 Bit OS or 64 Bit


Is it possible to check if computer is 32 bit or 64 using code? I just want to display the result in a message.

Please advise.

Environment.Is64BitOperatingSystem should do nicely.

Determines whether the current operating system is a 64-bit operating system.

The assumption being that a false signifies a 32bit environment.

If you want to find out if the process is 64bit (as you can run a 32bit process on a 64bit OS), use Environment.Is64BitProcess:

Determines whether the current process is a 64-bit process.

Both of these have been introduced in .NET 4.0.