How to check whether my OS is 64-bit or 32-bit?

If you were to do any actions using CMD scripting in Windows, you could start the batch file something like this:

@echo off

if %PROCESSOR_ARCHITECTURE% == x86 (
goto :x86
) else (
goto :x64
)

:x86
start "foo.exe"
goto :eof

:x64
start "bar.exe"
goto :eof

In many Unix-like systems you can type in:

uname -a

For FreeBSD it looks like:

FreeBSD whiplash 8.0-STABLE FreeBSD 8.0-STABLE #1: 
Tue Mar  9 15:38:19 CET 2010     root@beast:/usr/obj/usr/src/sys/WHIPLASH  amd64

(amd64 means that this kernel is 64-bit)

For Linux:

Linux softy.vm 2.6.18-128.el5 #1 SMP 
Wed Jan 21 10:44:23 EST 2009 i686 athlon i386 GNU/Linux

(i386 means that this kernel is 32-bit)

For MacOSX:

Darwin iMac.local 10.0.0 Darwin Kernel Version 10.0.0: Fri Jul 31 22:47:34 PDT 2009;
root:xnu 1456.1.25~1/RELEASE_X86_64 x86_64

(x86_64 means that this kernel is 64-bit)


Under Windows:

The GUI Way

  1. Press Win+R to open the Run... Dialog
  2. Enter winmsd
  3. Look for row Processor or System type

If they begin with x86 you have 32-Bit otherwise you have 64-Bit

Using cmd.exe
Enter SET PROCESSOR_ARCHITECTURE
x86 means 32-Bit, otherwise it's 64-Bit

Using Powershell
Enter $env:PROCESSOR_ARCHITECTURE
Meaning is the same as with using cmd.exe

Beware
There are two different types of 64-Bit architectures.
One is AMD64 for x64 the other is ia64 for Itanium (not sure this value is exactly like that, never worked with any of them)