How to tell if a .exe file is a 32-bit or 64-bit application using dumpbin

Goodfolk,

One of my customers wanted to know if they had really built a 64-bit application for their cluster. After all, we run WIndows HPC Server on a 64-bit server OS, so why not take full advantage of it?

I had a few minutes before I had to get back to them so I thought I'd try to polish the answer a bit. Here's what I told him: "Dumpbin is your friend."

Here's what I then provided as a really simple 'tool'. A one liner actually. If and only if you have

C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64

in your path. See my blog on compiling with Visual Studio from Powershell. This works fine from the old command line shell as well.

------------------------------------------------------------------------------------------------------------------------------------------------------

Windows PowerShell
Copyright (C) 2006 Microsoft Corporation. All rights reserved.

PS C:\Home\fchism> .\pVSvars.ps1
PS C:\Home\fchism> cd PGI
PS C:\Home\fchism\PGI> dir

    Directory: Microsoft.PowerShell.Core\FileSystem::C:\Home\fchism\PGI

Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d----         2/17/2009   2:54 PM            OSBench
d----         2/10/2009   4:17 PM            POP_PVF
-a---         3/26/2009   4:59 PM     135680 Hi.dwf
-a---         3/26/2009   4:59 PM     391168 Hi.exe
-a---         2/11/2009  11:00 AM         73 Hi.f
-a---         3/26/2009   4:59 PM    1436672 Hi.pdb
-a---         2/10/2009   4:31 PM  175156824 pgivfx64-vs2008-803.exe
-a---         2/10/2009  10:34 AM    1123401 pgi_whitepaper_unix2win.pdf
-a---         2/10/2009   4:08 PM    3526334 POP_PVF.zip

PS C:\Home\fchism\PGI> dumpbin /headers Hi.exe|findstr "magic machine"
            8664 machine (x64)
             20B magic # (PE32+)
PS C:\Home\fchism\PGI> cd C:\UnixUtilities
PS C:\UnixUtilities> dumpbin /headers zsh.exe|findstr "magic machine"
             14C machine (x86)
                   32 bit word machine
             10B magic # (PE32)
PS C:\UnixUtilities> cd ..\Home\fchism
PS C:\Home\fchism> more pVSvars.ps1
# Set up Visual Studio Variables for Powershell

--------------------------------------------------------------------------------------------------------------------------------------------------

A magic machine indeed! You can get dumpbin with any version of Visual Studio. If you don't have a commercial version go to https://www.microsoft.com/express/ .

Well short but I hope you find this to be a sweet hack.

 

Frankie