Windows: How to know if it is 32 or 64 bits


Forms via CMD:

1) Consulting an environment variable:

64bit embodiment:

C: \> echo% PROCESSOR_ARCHITECTURE%
AMD64

Embodiment for 32bit:

C: \> echo% PROCESSOR_ARCHITECTURE%
x86

Easily, we can use a CMD script to run one thing or another depending on the value of the environment variable.

Example:

if “% PROCESSOR_ARCHITECTURE%” == “x86” (
echo “The OS is 32 bits”
) Else (
echo “The OS is 64 bits”
)

2) Consultation of a key in the registry:

reg query “HKLM \ SYSTEM \ CurrentControlSet \ Control \ Session Manager \ Environment” / v PROCESSOR_ARCHITECTURE

Example output for 64bit execution:

HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ Session Manager \ Environment
REG_SZ AMD64 PROCESSOR_ARCHITECTURE

Example output for 32bit execution:

HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ Session Manager \ Environment
PROCESSOR_ARCHITECTURE REG_SZ x86

3) Consulting if a directory:

if not exist “% systemroot% \ Program Files (x86)” echo 32bit
if exist “% systemroot% \ Program Files (x86)” echo 64bit

4) Query WMI (Windows Management Instrumentation):

Since CMD:

wmic OS get OSArchitecture

Since PowerShell:

(Gwmi Win32_ComputerSystem) .SystemType

5) In systeminfo command:
systeminfo | findstr /I type:

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: