30

I'm writing a batch script for windows 7 and want to handle both 64 bit and and x86 processors.

What are the possible values of the Windows %PROCESSOR_ARCHITECTURE% environment variable?

2
  • 7
    'migrated from stackoverflow' ... it's as if someone doesn't think that batch scripting is proper programming!? – Rory Jun 23 '14 at 16:17
  • The top answer is outdated as of May 2019. Please see this one instead – undo May 26 '19 at 20:22
30

http://msdn.microsoft.com/en-us/library/aa384274.aspx

  • AMD64
  • IA64
  • x86

Note that this doesn't tell you the architecture of the processor but only of the process with the environment variable. It returns "x86" for a 32 bit process running on 64 bit Windows.

3
  • 10
    There's a workaround for the "32bit process on 64bit Windows" problem: just check PROCESSOR_ARCHITEW6432 as well, and if it isn't undefined (i.e. equals to AMD64 or IA64), then this is a 64bit machine. Source. – Alec Mev Jan 23 '14 at 11:35
  • 4
    Should add ARM in there now. – quadruplebucky Jul 16 '17 at 8:32
  • 2
    This answer is outdated as of May 2019. Please see this one instead. – undo May 26 '19 at 20:22
10

The top answer is currently outdated. As of May 2019, here are all the valid values of %PROCESSOR_ARCHITECTURE%:

64-bit:

  • AMD64
  • IA64
  • ARM64
  • EM64T

(EM64T is very rarely seen, almost always on Windows XP-64. You can safely ignore this in your scripts in most cases unless your code needs to be super backwards-compatible.)

32-bit:

  • X86

(source)

2
  • It should be noted that elsewhere it was said that the values should be downcased. I do not know whether it makes a difference, but in other examples I saw "amd64" rather than the all-upcased variant. – shevy Dec 29 '19 at 16:16
  • @shevy I don't think it matters, but fwiw, the output of echo %processor_architecture% is in all uppercase for me. – undo Jan 2 '20 at 5:08
6

"EM64T" is also a possible value, however unlikely. My understanding is that you will only see this with XP-64.