SurlyJake Blog

Windows 32 (X86) or 64 (AMD64) Detection in Batch Files

| Comments

While there are a lot of ways to detect for a 64 bit version of windows. you can test for %programFiles(x86)%, but handling the output and writing the IF comparisons is messy.

In Batch files, you can easily check for architecture by using the “processor_architecture” variable. x86 versions of windows will have this set to “x86”, and x64 versions “x64”. Here’s an easy example:

1
2
3
4
    @echo off
    IF %processor_architecture% == AMD64 echo This is a 64-bit version of windows
    IF %processor_architecture% == x86 echo this is a 32-bit version of windows.
    pause

Comments