Check for 32 bit vs 64 bit Microsoft OS in Windows Batch File

This is a usable example showing how to check for a 32 bit OS vs a 64 bit OS in MS windows within a batch file.

This is very useful when deploying certain applications through MS Group Policy.

Example from a .bat file:

@echo off
Set RegQry=HKLMHardwareDescriptionSystemCentralProcessor
REG.exe Query %RegQry% > checkOS.txt
Find /i "x86" < CheckOS.txt > StringCheck.txt
If %ERRORLEVEL% == 0 (
   CALL --32bit install goes here--
) ELSE (
   CALL --64bit install goes here--

The code simple checks the contents of the Registry entry then looks for the entry ‘x86’ indicating a 32 bit installation.
The batch file will leave the checkOS.txt in place on the end user machine.

Contents of the checkOS.txt file would look something like this:

    Component Information    REG_BINARY    00000000000000000000000000000000
    Identifier    REG_SZ    Intel64 Family 6 Model 37 Stepping 2
    Configuration Data    REG_FULL_RESOURCE_DESCRIPTOR    FFFFFFFFFFFFFFFF0000000000000000
    ProcessorNameString    REG_SZ    Intel(R) Core(TM) i7 CPU       M 620  @ 2.67GHz
    VendorIdentifier    REG_SZ    GenuineIntel
    FeatureSet    REG_DWORD    0x21193ffe
    ~MHz    REG_DWORD    0xa64
    Update Signature    REG_BINARY    000000000D000000
    Update Status    REG_DWORD    0x7
    Previous Update Signature    REG_BINARY    000000000D000000
    Platform ID    REG_DWORD    0x10
Tagged , , . Bookmark the permalink.

One Response to Check for 32 bit vs 64 bit Microsoft OS in Windows Batch File

  1. Greg says:

    The following will do the exact same thing, but NOT leave any text files behind on the computer:

    @echo off
    Set RegQry=HKLMHardwareDescriptionSystemCentralProcessor
    reg query “HKEY_LOCAL_MACHINEHardwareDescriptionSystemCentralProcessor” | find “x86” >nul
    If %ERRORLEVEL% == 0 (
    CALL –32bit install goes here–
    ) ELSE (
    CALL –64bit install goes here–

Leave a Reply

Your email address will not be published. Required fields are marked *

Solve : *
3 × 13 =