How to detect if Windows is running 32 or 64 bit from a command script: Difference between revisions

From Yggenyk
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
[[Category:English pages]]
[[Category:English pages]]
[[Category:Vista tips and tricks]]
[[Category:Vista tips and tricks]]
This is the simple and safe way to detect if Windows is running 64 bit (x64) or 32 bit (x86).
  @if /I "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
  @if /I "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
     echo We are running I a 64-bit process on a 64-bit OS
     echo We are running I a 64-bit process on a 64-bit OS

Revision as of 14:04, 11 January 2008


This is the simple and safe way to detect if Windows is running 64 bit (x64) or 32 bit (x86).

@if /I "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
   echo We are running I a 64-bit process on a 64-bit OS
) else if /I "%PROCESSOR_ARCHITECTURE%" == "X86" (
   @if /I "%PROCESSOR_ARCHITEW6432%" == "AMD64" (
      echo We are running in a 32-bit process on a 64-bit OS (WOW64)
   ) else (
      echo We are running in a 32-bit process on a 32-bit OS
   )
)

This is documented in Microsoft's document:

WOW64 Implementation Details - Environment Variables:


<google>ENGELSK</google>

id=siteTree