Possible Duplicate:
How to check if a binary is 32 or 64 bit on Windows?

In Windows 7, applications should be installed to "Program Files" or "Program Files (x86)" depending on whether they are 64-bit or 32-bit (respectively, as per this page).

Is there an easy way to check that all the applications on my system are in the correct Program Files directory?

To put it another way, is an easy way to detect any 32-bit applications in "Program Files" and 64-bit applications in "Program Files (x86)"?

  • Why do you believe they may have got mixed up? Also, this thread might interest you. – Karan Oct 15 '12 at 22:58
  • I wish someone answers with a really down-to-the-bits kind of answer. But the reality is probably that it is more practical to look at library linkings and certain strings, and not so much analyzing things byte by byte. – Ярослав Рахматуллин Oct 15 '12 at 23:13
  • It is not a duplicate because I want an answer that can be applied to dozens of applications without coding/scripting, or examining each individually. Still, too late now. – Anon Gordon Oct 16 '12 at 20:00

You can use the file command line utility. Basically, you invoke the command in a terminal and give it filenames as arguments. Like this:

$ file "Program Files (x86)/QuickTime/QTSystem/ExportController.exe"
Program Files (x86)/QuickTime/QTSystem/ExportController.exe: PE32 executable (GUI) Intel 80386, for MS Windows

$ file Program\ Files/CCleaner/*exe
Program Files/CCleaner/CCleaner64.exe: PE32+ executable (GUI) x86-64, for MS Windows
Program Files/CCleaner/CCleaner.exe:   PE32 executable (GUI) Intel 80386, for MS Windows
Program Files/CCleaner/uninst.exe:     PE32 executable (GUI) Intel 80386, for MS Windows, Nullsoft Installer self-extracting archive

If you know some Python or even Java, it should be relatively easy to run the command from within an application and test whether a given binary is this or that.

Apparently, there is a windows port here: http://gnuwin32.sourceforge.net/packages/file.htm

Another alternative, is of course Cygwin, with the added benefits of a bash shell.

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