Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

So, I need to do just that before I move the program to 32bit machine and experience a spectacular failure. Is there an easy way to do this?

share|improve this question
    
possible duplicate of Is there a windows command that returns the list of 64 and 32 process? –  Diogo Nov 17 '11 at 10:55
8  
Not a duplicate: an exe is not yet a process. –  Richard Nov 17 '11 at 12:10

5 Answers 5

up vote 31 down vote accepted

The SDK tool dumpbin.exe with the /headers option includes this information, compare these two (I've added bold for the key information)

PS [64] E:\ #4> dumpbin /headers C:\Windows\system32\cmd.exe
Microsoft (R) COFF/PE Dumper Version 10.00.40219.01
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file C:\Windows\system32\cmd.exe

PE signature found

File Type: EXECUTABLE IMAGE

FILE HEADER VALUES
            8664 machine (x64)
               6 number of sections
        4CE798E5 time date stamp Sat Nov 20 09:46:13 2010
               0 file pointer to symbol table
               0 number of symbols
              F0 size of optional header
              22 characteristics
                   Executable
                   Application can handle large (>2GB) addresses
[...]

and

PS [64] E:\ #5> dumpbin /headers C:\Windows\syswow64\cmd.exe
Microsoft (R) COFF/PE Dumper Version 10.00.40219.01
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file C:\Windows\syswow64\cmd.exe

PE signature found

File Type: EXECUTABLE IMAGE

FILE HEADER VALUES
             14C machine (x86)
               4 number of sections
        4CE78E2B time date stamp Sat Nov 20 09:00:27 2010
               0 file pointer to symbol table
               0 number of symbols
              E0 size of optional header
             102 characteristics
                   Executable
                   32 bit word machine
[...]
share|improve this answer
    
You could also see (IA64) for a 64bit Itanium exe. –  Darryl Braaten Nov 17 '11 at 17:01
3  
as i read elsewhere on superuser, using dumpbin /headers | findstr "machine" greatly simplifies the presentation of what the QA is looking for... –  user1055604 Mar 17 '13 at 14:10

A simple method is to run it (assuming you trust it) and take a look at the process tab in task manager. 32bit processes will show "* 32" at the end of the process name. If it's not something your willing to run on your computer you can try EXE Explorer. It will show a whole bunch of info on executables including if it's 32 or 64bit.

share|improve this answer
1  
Unfortunately, this requires you to run the executable. Perhaps you need to check the architecture of the program as a troubleshooting method on why it is not running. –  Mike Christiansen Oct 2 '12 at 16:20

The 64-bit version of Process Explorer can tell you. Simply run the executable and open the process's properties window. On the main tab there's an entry which says "Image:32 Bit" or "Image:64 Bit".

enter image description here

share|improve this answer
2  
Simply run the executable And what if you don’t want to run the program? –  Synetech Feb 6 at 9:23
    
@Synetech The original question doesn't imply that's the case. –  Andrew Lambert Feb 6 at 18:13

The method of running an executable & then checking in process explorer or similar tool, has some obvious drawbacks:

  1. We have to execute the process.
  2. For the short lived processes (like echo hello world types.), process explorer might not even register that a new process has started.

Dumpbin.exe method can solve the purpose probably.

Another alternative would be to use cygwin's file command. However, I have not tested it on windows. It works well on Linuxes.

Usage: file program_under_test.exe

EDIT: Just tested file.exe on window. works fine. :)

share|improve this answer
    
This adds nothing that wasn't said by Dracs or Richard. This still requires running the program which the author wanted to avoid. –  Ramhound Oct 19 '12 at 10:45
1  
Just wanted to say, that there are some situations, where Dracs's method will not be much helpful. –  anishsane Oct 19 '12 at 10:49
1  
>>This still requires running the program which the author wanted to avoid: No.. we run it like: file.exe program_under_test.exe –  anishsane Oct 19 '12 at 10:49
1  
And those who wish to avoid installing the whole cygwin package can grab the gnuwin32 file package. –  Bob Oct 19 '12 at 11:32
1  
@anishsane Completely wrong. file simply reads data from the disk in binary format and checks for any magic numbers identifying them, comparing against a database. Windows' 32-bit programs come up as PE32, and both 64-bit and .NET programs come up as PE32+. The bitness of file itself makes absolutely zero difference - both 32-bit and 64-bit applications can read data from the disk, which is all it needs. –  Bob Jan 17 at 2:24

I'm too new of a user to add a comment to anishsane's answer, but I can confirm that the file utility (e.g. from cygwin) does in fact distinguish between 32- and 64-bit executables. They appear as follows:

32.exe: PE32 executable (GUI) Intel 80386, for MS Windows
64.exe: PE32+ executable (console) x86-64, for MS Windows

As you can see, it's very obvious which is which. Additionally it distinguishes between console and GUI executables, also obvious which is which.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.