What's the command line to find out if the OS is running a 32-bit version or 64-bit of Windows?
10 Answers
You can get this via WMI:
wmic OS get OSArchitecture
Example on my system:
C:\>wmic OS get OSArchitecture
OSArchitecture
32-bit
- 535
Command line:
systeminfo | findstr /I type:
example output:
System type: X86-based PC
X86 indicates a 32-bit system in this example.
(/I parameter indicates case-insensitive search)
- 98
I can not attach answer to another post so here.
Piping the result of systeminfo - is taking a quite good amount in time and writes to the console so is not the best solution for command files (batch scripts - anyhow You like to call them B-) ).
Even with the findstr - it does not find this on other language version of windows.
On a central european language win7 os it also returns ..."X86-based"... on the result but something other on then the "type" were looking for. I am not sure that it can vary on other language variants of the os.
Probably the "wmic" method is the most reliable - it asks the os directly.
Other possible quick solution can be to examine a variable (at least working on win7 at me).
echo %PROCESSOR_ARCHITECTURE%
Ok - it is quite long to remember but possible a set | findstr ARCH can be remembered.
Sure - some can modify a system variable so not that reliable than wmic. But can be used quickly.
I hope I could help someone out.
- 161
There are numerous ways to check the processor architecture under Windows:
The fastest, easiest, and most compatible way to check the processor architecture in at least Windows 2000 and up is to examine the
PROCESSOR_ARCHITECTUREenvironment variable:echo %PROCESSOR_ARCHITECTURE%However, this can give different results, depending on the way in which the command-prompt is opened. To avoid getting “unexpected results” due to WoW64, you can read it directly from the registry (Microsoft made no less than two typos in the key):
reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v PROCESSOR_ARCHITECTUREMicrosoft also suggests reading the hardware information store from the registry:
reg query "HKLM\Hardware\Description\System\CentralProcessor\0" /v IdentifierYou can also check for the existence of the x86 version of the
Program Filesdirectory (or the environment variable that points to it) since it would only exist on a 64-bit system. Unlike thePROCESSOR_ARCHITECTUREvariable, this is not dependant on the way that the command prompt is run since the directory exists (or not) regardless of how the prompt is opened:::via env-var
if not defined ProgramFiles(x86) echo 32-bit::via file-system
if not exist "%systemdrive%\Program Files (x86)" echo 32-bit
These methods can be combined in a single batch-file (e.g., cpuinfo.bat) and provides a nice, lightning fast way to check the system from a standard Windows NT command-prompt without needing to resort to running other programs or frameworks.
The batch-file below was tested on 32-bit and Intel 64-bit systems (please test on AMD64), giving correct results in <1 second:

@echo off
echo PROCESSOR_ARCHITECTURE var:
echo %PROCESSOR_ARCHITECTURE% | find /i "x86" > nul
if %errorlevel%==0 (
echo 32-bit
) else (
echo 64-bit
)
echo.
echo PROCESSOR_ARCHITECTURE reg:
reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v PROCESSOR_ARCHITECTURE | find /i "x86" > nul
if %errorlevel%==0 (
echo 32-bit
) else (
echo 64-bit
)
echo.
echo CentralProcessor reg:
reg query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > nul
if %errorlevel%==0 (
echo 32-bit
) else (
echo 64-bit
)
echo.
echo ProgramFiles(x86) var:
if not defined ProgramFiles(x86) (
echo 32-bit
) else (
echo 64-bit
)
echo.
echo ProgramFiles(x86) dir:
if not exist "%systemdrive%\Program Files (x86)" (
echo 32-bit
) else (
echo 64-bit
)
echo.
- 4,158
- 69,547
I could not find the OSArchitecture property (as per phoebus' answer) so I would suggest using the SystemType property in ComputerSystem instead.
Running the command wmic computersystem get systemtype from a command prompt gives
C:\Windows\system32>wmic computersystem get systemtype
SystemType x64-based PC
Regular command line: wmic OS get OSArchitecture (IIRC)
PowerShell: (gwmi win32_computersystem).SystemType
- 4,001
Go to Start » Run and then type cmd. Now you will be in command prompt. There you can type systeminfo and then press enter. It takes a few seconds to get all your system information. You can find the processor data too.
Processor(s): 1 Processor(s) Installed.
[01]: x86 Family 15 Model 4 Stepping 10 GenuineIntel
- x86 Family means, your processor is 32-bit.
- x64 Family means, your processor is 64-bit.
C:\Documents and Settings\mr85464>systeminfo
OS Name: Microsoft Windows XP Professional
OS Version: 5.1.2600 Service Pack 3 Build 2600
OS Manufacturer: Microsoft Corporation
OS Configuration: Member Workstation
OS Build Type: Multiprocessor Free
Product ID: 76487-640-3658033-23932
Original Install Date: 3/16/2012, 2:03:44 PM
System Up Time: 5 Days, 21 Hours, 35 Minutes, 51 Seconds
System Manufacturer: Dell Inc.
System Model: OptiPlex 210L
System type: X86-based PC
Processor(s): 1 Processor(s) Installed.
[01]: x86 Family 15 Model 4 Stepping 10 GenuineIntel
~2992 Mhz
- 235,242
if you are referring to windows OS, you can use vbscript with WMI
strComputer = "."
Set objWMIService = GetObject("winmgmts{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\" & strComputer & "\root\cimv2")
Set colSettings = objWMIService.ExecQuery("SELECT * FROM Win32_Processor")
For Each objProcessor In colSettings
Wscript.Echo "System Type: " & objProcessor.Architecture
Wscript.Echo "Processor: " & objProcessor.Description
Wscript.Echo "Address Width: "& objProcessor.AddressWidth
Next
- 2,937
You can find that Information using "System Information"
Start-> Run -> winmsd.exe
Under "System Summary"/ System Type you can find the OS version
X64 -> 64 Bit
X86 -> 32 Bit
JohnT's answer in GUI ;)
- 10,800
Simple code I used:
:arch
set p | findstr /i AMD64 > nul
if not errorlevel 1 goto no64
goto eof
:no64
code to execute
:eof
- 89,072
- 65
- 269
- 311
- 1