EXE is the common filename extension for
denoting an executable file (a program) in the MS-DOS, Microsoft
Windows, and OS/2 operating systems. Generally, "exe" may be used
as a noun to refer to such a file.
There are several main EXE file formats.
* DOS executable: These can only be identified by the ASCII string
"MZ" or the hexadecimal 4D 5A at the beginning of the file (the
"Magic number" ). These executables are the least complex in
DOS/Windows and can be run from both ("MZ" are the initials of Mark
Zbikowski, one of the developers of MS-DOS).
* 16-bit New Executable: These can be identified by the "NE" in
ASCII. These cannot be run by DOS but can be run by all Windows and
OS/2 versions.
* Mixed 16/32-bit Linear Executable: These can be identified by the
"LE" in ASCII. This format is not used for applications, but
instead for VxD drivers under Windows 3.x and Windows 9x.
* 32-bit Linear Executable: These can be identified by the "LX" in
ASCII. These can only be run by OS/2 2.0 and higher.
* 32-bit Portable Executable: These are the most complex and can be
identified by the "PE" in ASCII. These can be run by all versions
of Windows NT, and also Windows 95 and higher. They are also used
in BeOS R3, however they somewhat violate the PE specification as
they don't specify a correct subsystem.
* 64-bit: These are similar to PE files, but make use of 64-bit
extensions supported by the CPU. These can only be run by 64-bit
editions of Microsoft Windows, such as Windows XP 64-Bit Edition or
Windows Server 2003 64-Bit Edition.
Besides them, there are also many custom EXE formats, such as W3 (a
collection of LE files, only used in WIN386.EXE), W4 (a compressed
collection of LE files, only used in VMM32.VXD), DL, MP, P2, P3
(last three used by Phar Lap extenders), and probably more.
When a 16-bit or 32-bit executable is run by Windows, execution
starts at either the NE or the PE. On the other hand, DOS cannot
execute these files. To prevent DOS from crashing, all Windows
executable files must start with a working DOS program. Normally
this program simply displays a message that it cannot run in DOS
mode, but some Windows programs (such as regedit) have a usable DOS
section.