Powershell check if .NET executable is x86 or x64

Do you want to check if a (.NET) assembly has been built for x86 or x64? You can do this via the following Powershell snippet. Simple run the following command in a Powershell window:

PS D:\> [reflection.assemblyname]::GetAssemblyName("${pwd}\MyExecutable.exe") | fl

Name                  : MyExecutable
Version               :
CultureInfo           :
CultureName           :
CodeBase              : file:///D:/MyExecutable.exe
EscapedCodeBase       : file:///D:/MyExecutable.exe
ProcessorArchitecture : Amd64
ContentType           : Default
Flags                 : None
HashAlgorithm         : SHA1
VersionCompatibility  : SameMachine
KeyPair               :
FullName              : MyCodebase.MyExecutable.exe, Version=, Culture=neutral, PublicKeyToken=null

In the output above you should look for this line:

ProcessorArchitecture : Amd64

In this case this assembly is built for 64-bit platforms (AMD64). This is the full list of possible values:

  • Amd64: A 64-bit processor based on the x64 architecture.
  • Arm: An ARM processor.
  • IA64: A 64-bit Intel Itanium processor only.
  • MSIL: Neutral with respect to processor and bits-per-word.
  • X86: A 32-bit Intel processor, either native or in the Windows on Windows environment on a 64-bit platform (WOW64).
  • None: An unknown or unspecified combination of processor and bits-per-word.

Good luck!

By Leendert de Borst

Freelance software architect with 10+ years of experience. Expert in translating complex technical problems into creative & simple solutions.

Leave a comment

Your email address will not be published. Required fields are marked *