Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This question already has an answer here:

What's the command line to find out if the OS is running a 32-bit version or 64-bit of Windows?

share|improve this question
    
In what language?! –  Alix Axel Jan 15 '10 at 5:30
    
@AlixAxel, well they said command-line, so presumably, if anything, Batch. –  Synetech Jun 24 '12 at 15:27
add comment

migrated from stackoverflow.com Jan 15 '10 at 5:39

This question came from our site for professional and enthusiast programmers.

marked as duplicate by Synetech, Tog, Shakehar, Kevin Panko, MariusMatutiae Dec 1 '13 at 5:14

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

10 Answers

You can get this via WMI:

wmic OS get OSArchitecture

Example on my system:

C:\>wmic OS get OSArchitecture
OSArchitecture
32-bit
share|improve this answer
    
I like this answer (gotta go learn me some WMI console :) ), but I gotta give it to "systeminfo" for keystrokes. ;) –  techie007 Jan 15 '10 at 5:45
    
XP?​​​​​​​​​​​​ –  Synetech Jun 24 '12 at 14:22
add comment

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)

share|improve this answer
    
I gave you a point for keystrokes, and then you made it longer. hehe :) –  techie007 Jan 15 '10 at 6:10
    
It's not my answer :P –  John T Jan 15 '10 at 6:19
2  
But is "X86-based PC" the same as OSArchitecture 32-bit? You can run 32-bit Win XP on an x64 processor. –  Michael Caron Mar 27 '12 at 15:52
add comment

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
share|improve this answer
add comment

Regular command line: wmic OS get OSArchitecture (IIRC)

PowerShell: (gwmi win32_computersystem).SystemType

share|improve this answer
    
I get Invalid Query in XP. –  Synetech Jun 24 '12 at 14:23
add comment

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 ;)

share|improve this answer
add comment

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.

share|improve this answer
    
I wasn't sure the echo command would work on my XP box because I've never seen this environment variable before (perhaps because I've never looked for it), but it does. +1 for a simple solution. –  music2myear Oct 20 '11 at 15:58
add comment

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
share|improve this answer
2  
Takes a few seconds indeed! And running it again won’t help because it doesn’t cache the information. Also, the Windows updates cause the part about the architecture to quickly scroll off-screen, so unless you have a large enough buffer, you need to pipe it into more. –  Synetech Sep 20 '12 at 5:14
add comment

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
share|improve this answer
add comment

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_ARCHITECTURE environment 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_ARCHITECTURE

  • Microsoft also suggests reading the hardware information store from the registry:

    reg query "HKLM\Hardware\Description\System\CentralProcessor\0" /v Identifier

  • You can also check for the existence of the x86 version of the Program Files directory (or the environment variable that points to it) since it would only exist on a 64-bit system. Unlike the PROCESSOR_ARCHITECTURE variable, 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:

Test results

@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.
share|improve this answer
add comment

Simple code I used:

:arch
set p | findstr /i AMD64 > nul
if not errorlevel 1 goto no64
goto eof
:no64
code to execute
:eof
share|improve this answer
add comment