COM File - Execution Preference

Execution Preference

In MS-DOS, if a directory contains both a COM file and an EXE file with same name (not including extension), the COM file is preferentially selected for execution. For example, if a directory in the system path contains two files named foo.com and foo.exe, the following would execute foo.com:

C:\>foo

A user wishing to run foo.exe can explicitly use the complete filename:

C:\>foo.exe

Taking advantage of this default behaviour, virus writers and other malicious programmers have used names like notepad.com for their creations, hoping that if it is placed in the same directory as the corresponding EXE file, a command or batch file may accidentally trigger their program instead of the text editor notepad.exe.

On Windows NT and derivatives (Windows 2000, Windows XP, Windows Vista, and Windows 7), the PATHEXT variable is used to override the order of preference (and acceptable extensions) for calling files without specifying the extension from the command line. The default value still places .com files before .exe files. This closely resembles a feature previously found in JP Software's line of extended command line processors 4DOS, 4OS2, and 4NT.

Read more about this topic:  COM File

Famous quotes containing the words execution and/or preference:

    I will soon be going out to shape all the singing tomorrows.
    Gabriel Péri, French Communist leader. Letter, July 1942, written shortly before his execution by the Germans. Quoted in New York Times (April 11, 1943)

    Do not discourage your children from hoarding, if they have a taste to it; whoever lays up his penny rather than part with it for a cake, at least is not the slave of gross appetite; and shows besides a preference always to be esteemed, of the future to the present moment.
    Samuel Johnson (1709–1784)