Talk:COM file

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Default path[edit]

I deleted the discussion of how the default path in UNIX helps prevent execution of maliciously named binaries in the current directory. While this is a similar problem, even if this were the case in MS-DOS it wouldn't fix the problem, since the COM file is usually placed in the same directory as the EXE file, in which case it would still find the COM file before the EXE file. It seems more appropriate for an article about paths and default search paths. Deco 19:21, 17 Apr 2005 (UTC)

Exactly how is a .COM binary a fat binary?[edit]

Would someone care to explain that? I am under the impression that a .COM file is just loaded to some segment as is and the operating system jumps to run it. I do not think that MS-DOS on PC has the ability of running fat .COM files, it is just so simple and dumb loading of the binary as possible. I do believe .EXE files can be fat binaries, since on Windows 3.11 the programs usually check if Windows is running or not, and there is many DOS device drivers which are .EXE files but still can be loaded like .SYS files, because the files have both properties of a program and a device driver structure implemented somehow. Those who know better can enlighten me.

It isn't something done by the operating system; it's done by the COM file itself. The first few bytes have to be, simultaneously, valid x86 code and valid x80 code. For example, the utilities in the MYZ80 emulator start 0xEB 0x52 0xEB. An 8086 sees this as a jump and reads its next instruction from 0x0154; an 8080 goes straight through and reads its next instruction from 0x0103. A fully fat COM file would then include two copies of the rest of its code, one for CP/M and x80, and one for MS-DOS and x86. HungryHorace 11:43, 17 January 2006 (UTC)[reply]

By the way, MS-DOS and CP/M "compatibility" is only somewhat possible if you confine yourself to the system functions of MS-DOS version 1; a whole new series of radically revamped DOS function calls was introduced with DOS 2.0 in 1983 (adding file handles, subdirectory support, and ASCIIZ strings, among other things), and very quickly came to be used in preference to the roughly equivalent DOS 1 functions for most purposes by most programs. By 1985, CP/M compatibility was only of interest to a quite small number of PC users... AnonMoos (talk) 09:51, 26 October 2008 (UTC)[reply]

Is there any reference for this? Pol098 (talk) 13:17, 17 November 2011 (UTC)[reply]

Malicious Use and .COM vs .EXE[edit]

The section on Execution preference and its subsection Malicious use are not totally related. Execution preference contains an example of malicious use. The malicious use listed under Malicious use (having a COM file resemble a URL) does not really relate to Execution preference. I think this needs to be reorganized. Agree/disagree? Arun Philip 16:59, 30 January 2006 (UTC)[reply]

I think the word "capitalise" is being misused. Capitalism suggests exploitation for the purpose of generating revenue, whereas virus writers operate for other reasons. So I'm changing it to "take advantage". Bbi5291 (talk) 19:41, 24 June 2008 (UTC)[reply]

Take advantage is clearer so I left it be. The use of capitalise was correct. See dictionary.com definition 7. TLConrow (talk) 02:47, 21 September 2008 (UTC)[reply]

Command line arguments and COM files[edit]

There are no details on what the system puts in between 0x00 and 0xFF at program execution. It is reserved, but what does it contain? I have been told the command line parameters were stored in there somewhere. That information is seldom available on the internet tho. --88.170.36.239 (talk) 11:01, 28 March 2008 (UTC)[reply]

http://en.wikipedia.org/wiki/Program_Segment_Prefix —Preceding unsigned comment added by 76.170.204.223 (talk) 05:53, 25 June 2008 (UTC)[reply]

Legitimate use[edit]

Should we mention how little legitimate use there is for a .com file on a modern home computer, if any? We try to reassure people there's nothing dangerous about a .com files, but when's the last time you saw a legitimate .com file on a home computer? --12.196.11.130 (talk) 22:01, 19 July 2010 (UTC)[reply]

I know that Visual Studio uses a .com file in order to allow the command "devenv" to correspond to a command line application despite the fact that devenv.exe is a windows application. --Kragen2uk (talk) 03:50, 4 February 2011 (UTC)[reply]
COMMAND.COM is still widely found on PCs. -- 213.105.186.124 (talk) 01:21, 10 July 2012 (UTC)[reply]

Platform support[edit]

The article erroneously give the impression that the executable .COM extension is no longer valid on 64-bit Windows. Someone might like to explain that this is not the case and why: For example I have a BCBeCyPDFMetaEdit.com and WinSCP.com in my binaries directory that run under 64-bit Windows. So these must be either valid Win32 or Win64 applications with a the file Properties->Details "Type" of "MS-DOS Application" even though they are not. (They may well be WinXX Console EXEs with a COM extension that get loaded as a result of a .COM extension still existant in the PATHEXT on Win64. If so or not someone might like to explain this.) 122.148.41.172 (talk) 02:05, 29 June 2012 (UTC)[reply]

11 years have passed and that impression is still present in the article. Funny thing, a tree command that can be used in Command Prompt is in fact a... .COM file, still available in 64-bit Windows! 83.11.130.13 (talk) 15:35, 6 July 2023 (UTC)[reply]

"Originally, the term stood for "Command file""[edit]

I read somewhere, though I forget where, that the ".COM stands for Command File" was simply a common misconception and that COM is actually "Common Image". This is not simply a piece of idle gossip as I believe I read it in a respected textbook, however I cannot seem to find which one. Anyone able to enlighten me upon the truth and perhaps update the article accordingly? -- 213.105.186.124 (talk) 01:30, 10 July 2012 (UTC)[reply]

Seems I was thinking of "Core Image", not "Common Image". With some Googling, there seems to be quite a bit of evidence that this is the case. -- 213.105.186.124 (talk) 15:43, 8 May 2013 (UTC)[reply]
I seriously doubt that. A textbook does not prove anything. If you want a solid definition better try to find one in the original vendor documentation for these operating systems.
As far I as know, the origin of binary executable files with the file extension .COM is in 8-bit CP/M (since ca. 1973). Such files were typically called transient commands or transient programs to be executed in the TPA (Transient Program Area) under CP/M.
By way of SCP's 86-DOS in 1980, MS-DOS/PC DOS and the other DOSes for x86-machines inherited this file extension for binary executables. They were officially called external commands by SCP and Microsoft.
COM files already existed in DEC's RT-11, a system which inspired many commands in CP/M, but in RT-11 it was still an executable text file format, kind of a predecessor to batch files. A COM file in RT-11 was called command file.
Therefore, I don't see how the terms core or image would fit in there other than that CP/M and DOS COM files are binary code images, nothing more. --Matthiaspaul (talk) 18:21, 8 May 2013 (UTC)[reply]
I'm not sure what's correct, however, look at every other language of Wikipedia. Seems they support this version. I assume they had a reason... -- 213.105.186.124 (talk) 20:34, 8 May 2013 (UTC)[reply]
Wikipedia itself is not a reliable reference we can use, but sometimes it can give hints. Therefore, I checked out the 16 other Wikipedia articles on this subject. All but two (the Italian and Polish WP) state something equivalent to "command file", the Italian and Polish WPs give a source for "core image": Borland International, Inc.: Borland Turbo Assembler - User's guide. U.S.A.: 1996, page 229. I don't have this edition, but I looked it up in my copy of: Borland International, Inc.: Borland Turbo Assembler 3.2 - User's Guide, 1992. In fact, on page 312, the COM format (not file) is defined as COre iMage, and the EXE format as EXEcutable. In all other places they just speak of COM programs and EXE programs. An equivalent section can be found in my German issue of Borland Turbo Assembler 3.0 Benutzerhandbuch, 1992 on page 303 (translated by Alois Stockklauser and Christian Stummer), but I could not find this definition in my copy of Borland Turbo Assembler 2.0 Benutzerhandbuch, 1990. However, for as long as we don't find a definition pre-dating CP/M or even RT-11 (1970s), I see this as a (rather strange) backronym coined in the early 1990s by an anonymous staff writer at Borland. --Matthiaspaul (talk) 02:13, 9 May 2013 (UTC)[reply]

.com Isn't used for viruses.[edit]

I have never seen .com used as a virus. LMGN (talk) 17:29, 13 December 2015 (GMT)

Most of these are .com files. --> https://www.wired.com/2013/10/15-awesome-looking-viruses-from-the-ms-dos-era/ MrZoolook (talk) 12:51, 14 January 2017 (UTC)[reply]

Sources[edit]

Raymond Chen has a nice blog post that explains a lot of the history and differences between COM and EXE files. He's clearly an authority on the topic but is this a reliable source, given that it's an "unofficial" blog post? https://blogs.msdn.microsoft.com/oldnewthing/20080324-00/?p=23033 GSMR (talk) 19:40, 16 July 2016 (UTC)[reply]

.com (command) = .com (commercial)[edit]

Actually, the name collision not that coincidental: both are the same Latin prefix com-.

Joe Forster/STA (talk) 19:09, 18 December 2017 (UTC)[reply]