Why %processor_architecture% always returns x86 instead of AMD64

后端 未结 9 2277
被撕碎了的回忆
被撕碎了的回忆 2020-11-29 03:03

I am trying to retrieve the environment variable to detect whether the system is 32 or 64 bit. But on 64 bit server the environment variable %processor_architecture%

相关标签:
9条回答
  • 2020-11-29 03:43

    Are you actually running a 64-bit version of Windows? If you are running 32-bit Windows on a 64-bit-capable CPU, you will still get x86.

    0 讨论(0)
  • 2020-11-29 03:43

    Assuming 64bit PC with 64bit Windows installation.

    %processor_architecture% returns x86 only when getting the value in 32bit programs. In 64bit programs it returns correctly AMD64.

    Example: execute echo %processor_architecture% from:

    • 32bit Total Commander
    • 64bit Explorer
    0 讨论(0)
  • 2020-11-29 03:43

    I think part of the reason it is like this way is that the x86-64 architecture has to allow 32-bit programs to treat it as identical (as far as possible) to a 32-bit environment and make sure that 32-bit programs do not think it is 64-bit only (like the Itanium architecture).

    This however makes it very frustrating to people who need to access the differences between the x86-64 architecture vs 32 bit architecture on Windows.

    0 讨论(0)
提交回复
热议问题