How-to: Detecting 64 bit vs 32 bit

Before starting to look at this, its important to be clear about what you mean by "64 bit".
You can have a 64 bit CPU, a 64 bit operating system and a 64 bit process running.

Here are the possible combinations:

  CPU Hardware Operating System Process
32 bit hardware 32 32 32
32 bit OS 64 32 32
32 bit application 64 64 32 (WOW)
Full 64 bit 64 64 64

Detect 64 bit processor hardware

There are a number of promising looking options in WMI and Systeminfo, but they all pertain to the OS not the CPU.
Obviously a 64 bit OS must be running 64 bit hardware, but a 32 bit OS could also be running on 64 bit hardware.
There is currently no known way of detecting this.

Detect a 64 bit Operating System

In Vista and greater, you can use WMIC OS get osarchitecture, or in WMI/CIM Win32_ComputerSystem/OSArchitecture

In batch:

:: Installed OS
Set _os_bitness=64
Echo Operating System is %_os_bitness% bit

Via David Wang’s blog post: Detect OS Bitness

Windows 10 on ARM includes an x86-on-ARM64 emulation, so the possible values for PROCESSOR_ARCHITECTURE are: AMD64 or IA64 or ARM64 or (for 32 bit) x86

In PowerShell (3.0+) we can use:


Detect a 64 bit Process

We can detect this with the PROCESSOR_ARCHITEW6432 variable, AMD64 = a 32 bit process under WOW64 mode:

If "%PROCESSOR_ARCHITEW6432%" == "AMD64" ECHO 32 bit process


If exist %SystemRoot%\SysNative\cscript.exe Echo 32 bit process

You may often see incorrect suggestions that testing for the existence of files in \windows\SysWOW64 or \windows\System32 can be used to detect 32 bit or 64 bit, but this will not work - the redirector will make both locations appear present to 32 bit and 64 bit processes.

In PowerShell (1.0+):
if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") {"32 bit process"}

In PowerShell (3.0+) we can use:



[bool]$is64 = [system.environment]::Is64BitProcess
If ($is64 -eq $True) {echo "64 bit process"}

System Folders

64 bit versions of Windows have dynamic system folders C:\Windows\sys* to support both 64 and 32 bit programs.
PowerShell.exe, CMD.exe and many other programs are available as both 32 bit or 64 bit.

The dynamic sys folders will appear differently to a 32 bit session and a 64 bit session:

  32 bit folder 64 bit folder
32 bit session C:\Windows\system32\ C:\Windows\sysNative\
64 bit session C:\Windows\sysWOW64\ C:\Windows\system32\

By default a 32 bit session will launch 32 bit executables from C:\Windows\System32\ but, if the OS is 64 bit, then you can still choose to launch 64 bit executables by specifying SysNative. A 32 bit session can also access 32 bit files by directly referencing the sysWOW64 folder (though there is generally no need to do that).

By default a 64 bit session will launch 64bit executables also from C:\Windows\System32\ but you can still choose to launch 32 bit executables by specifying sysWOW64.

The sysNative alias is not visible to 64 bit processes or programs and so cannot been seen in Windows Explorer.

The PROCESSOR_ARCHITEW6432 environment variable. If it’s set, then you’re in a 32-bit process on 64-bit Windows, and can use SysNative. If it’s not set, then you’re either in a 32-bit process on 32-bit Windows, or in a 64-bit process on 64-bit Windows. In that case, you can use System32.

File location environment variables

%ProgramFiles%      = 32 bit programs on 32 bit systems "C:\Program Files"
%ProgramFiles%      = 64 bit programs on 64 bit systems "C:\Program Files"
%ProgramFiles(x86)% = 32 bit programs on 64 bit systems "C:\Program Files (x86)"

%SystemRoot% = Windows installation folder, typically "C:\Windows"

Run a 32 bit program

To run a 32 bit program or utility on a 64 bit OS, the 32 bit executable file must be called from %SystemRoot%\SysWOW64\

So for example to run a VBScript as a 32 bit process, use:

%SystemRoot%\SysWoW64\cscript.exe C:\scripts\demo.vbs

Running %SystemRoot%\SysWOW64\cmd.exe will launch a 32 bit instance of CMD.exe even if the OS is 64 bit.

When you run a 32 bit shell (such as C:\windows\syswow64\cmd.exe) and then try to launch a command from that shell, it will always look for a 32 bit version of the command, even if you explicitly use a full path to system32, Windows will redirect to the 32 bit equivalent in syswow64 (if no 32 bit version of the command is found, then the new process will fail to launch.)

So the following will also run a 32 bit VBScript:

cscript.exe C:\scripts\demo.vbs

Run a 64 bit program from a 32 bit process

To run a 64 bit program from a 32 bit process use the virtual folder C:\Windows\sysnative

In many cases this is not needed as most utilities (e.g. ping.exe) have both a 32 bit and 64 bit version, however a few utilities (nbtstat, bcdedit) are only available as a 64-bit executable.

Most of the time you don't have to think about any of this, by default, running for example "CMD" from the start menu on a 64 bit version of Windows will launch a 64 bit process (C:\Windows\System32\cmd.exe). On a 32 bit version of Windows, running "CMD" from the start menu will launch an equivalent 32 bit process. Only in cases where a utility is not available in the needed bitness (usually 64 bit) do you need to consider calling the other version.

“It's not so much that we're afraid of change or so in love with the old ways, but it's that place in between that we fear... it's like being between trapezes” ~ Marilyn Ferguson

Related commands

How-to: Environment Variables - Documented (standard) and undocumented environment variables.
WMIC OS - Get OSArchitecture.
Q556009 - How to check if a computer is running a 32 bit or 64 bit Operating System (archived link from 2018).
Q896458 - 64-bit Windows does not support 16-bit applications.

Copyright © 1999-2024
Some rights reserved