Detect whether current Windows version is 32 bit or 64 bit

To check for a 64-bit version of Windows in a command box, I use the following template:


@echo off
if defined ProgramFiles(x86) (
    @echo yes
    @echo Some 64-bit work
) else (
    @echo no
    @echo Some 32-bit work

ProgramFiles(x86) is an environment variable automatically defined by cmd.exe (both 32-bit and 64-bit versions) on Windows 64-bit machines only.

Leave a Comment