Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I see a few COM files in my 64-bit Windows\System32 folder:

Does anyone happen to know:

  • Why these have the COM extension? (i.e. are they truly COM files?)
  • Is their file format documented? (Are they the same as 64-bit EXE PE files by any chance?)
share|improve this question
up vote 5 down vote accepted

COM files are a holdover from the MS-DOS days. They had meaning back then, however now they are obsolete. Today COM files are actually EXEs, but keep the COM extension for backwards compatibility with older DOS and Windows programs.

share|improve this answer
+1 ... Whilst I knew what .Coms where, I had no idea that they were just .exe files now (Had to test for myself by renaming a .com to .exe... and I also took a copy then renamed notepad.exe to!)... That is cool! I wish I could upvote you more. – William Hilsum Aug 25 '11 at 8:48
+1 ditto what @William said. :) By the way (this is somewhat unrelated) do you happen to know how to echo arbitrary bytes using batch files on 64-bit Windows? It seems like the old COM tricks don't work anymore... – Mehrdad Aug 25 '11 at 8:50
Keeping the .COM extension when they're .EXE makes no sense to be. .COM files are (were) plain binaries while .EXE have headers and additional information (like all modern executable formats). So MS-DOS would never be able to execute those new .COM files. – m0skit0 Aug 25 '11 at 10:24
the kept the .COM extension so if an old program calls, it would still function. – Keltari Aug 25 '11 at 10:25
And to add to what Keltari said, m0skit0: MS-DOS cannnot execute the .exe files either, so whether MS-DOS can execute things really has nothing to do with the filename. MS-DOS cannot execute any of these Win32 programs. You're using an operating system that isn't DOS and never has been. Moreover, your notion of how these things are divided up wasn't even the case for DOS some twenty years ago, let alone now. – JdeBP Aug 25 '11 at 23:15

Testing the executables using the GNU File tool reveals that they are in fact just 32-bit executables.

file.exe C:\Windows\System32\
C:\Windows\System32\; PE32 executable for MS Windows (console) Intel 80386 32-bit

share|improve this answer
Yep, and it's actually unnecessary to test them as everything in System32 should be 32-bit... :-) – Brian Knoblauch Aug 25 '11 at 17:14
For 64bit Windows installations everything in System32 is 64bit, the 32bit stuff is in SYSWOW64. However any 32bit running programs see the contents of SYSWOW64 under System32 due to the File System Redirector part of WOW64 (Windows on Windows 64bit). – Brian Dec 19 '11 at 2:32

The filename extension has nothing to do with the executable program image file format, and didn't even do so in the days of MS-DOS.

Don't get confused about filename extensions. There's a "COM" program image file format, which is a fairly basic program image format. It was superseded by the "MZ" program image file format back in the 1980s (which in turn has been superseded by the "PE" program image file format and several others). But it has nothing to do with the filename extension.

A program image file for MS-DOS/PC-DOS/DR-DOS can have either the extension .COM or the extension .EXE, but the actual image file format is not dictated by this. This is as true for 64-bit Windows NT 6.1 now as it was for MS-DOS version 3.3 back in the 1980s. The filename extension does not now dictate, and (effectively, given how early in the history of MS-DOS this changed) never has dictated, the program image file format for executables.

I mention DR-DOS. In DR-DOS version 6 (if memory serves correctly) practically all of the program image files, even the ones named .COM, were actually "MZ" format executables, and compressed ones at that. (At the time that that version of DR-DOS was released, in MS-DOS some of the program image files still used the actual "COM" format.) This is exactly the same as what you are seeing here. The names MODE.COM, FORMAT.COM, MORE.COM, and so forth, are the names that the programs have always had, retained for compatibility. But the program image format isn't the "COM" format. It's the "PE" format.

This really shouldn't come as any surprise or shock. After all, the programs whose filenames end in ".EXE" — such as ATTRIB.EXE and COMP.EXE — are not "MZ" format executables as they once were on MS-DOS, but are (also) "PE" format executables; and this situation has been the case on Windows NT for what is approaching two decades. After all, only the "PE" format (of those mentioned) is natively executable on Windows NT. The "MZ" and "COM" formats are only executable by dint of a Virtual DOS Machine. All of these programs have, on Windows NT, been Win32 programs, using the "PE" format, for a long time.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .