What is the difference between the a.bat, a.com and a.exe extensions?
A . BAT (short for "batch") file is a plain text file that contains a series of Windows commands. An . EXE (short for "executable") file is a binary file that contains much more complex executable binary code.
A COM file is a type of simple executable file. On the Digital Equipment Corporation (DEC) VAX operating systems of the 1970s, . COM was used as a filename extension for text files containing commands to be issued to the operating system (similar to a batch file).
A batch file is a script file that stores commands to be executed in a serial order. It helps automate routine tasks without requiring user input or intervention. Some common applications of batch files include loading programs, running multiple processes or performing repetitive actions in a sequence in the system.
Next, launch the Bat To Exe Converter and click on the Open toolbar button at the window's top-left corner, and locate the batch file you want to convert (HelloWorld. bat). 3. Click on Convert to provide a name and target location for the EXE file, then click Save to convert your batch file to an EXE file.
.bat is a batch file. It is interpreted.
.exe is a regular executable program file.
A .com file, at least for MS-DOS, has many meta-data missing and is loaded into a specific offset in the main memory. It is smaller than .exe
Originally, a .COM
file was a literal blob of 8086 code (that is, 16-bit x86). It is meant to be loaded at a fixed address, and the loader would jump straight to the first byte of its address. It's also limited in size.
An .EXE
file has more header information. So it has required structures for things like dynamic linking, where code from a DLL can be patched into the .EXE
's memory space at load time.. It originally comes from DOS, but it's today used in Windows.
However DOS and Windows eventually went to a model where the file extension in a .COM
and .EXE
didn't mean anything. The program loader first checks the first two bytes of the file. If it happens to be the string MZ
(legend has it this stands for the initials of an early Microsoft employee), it will treat it as an EXE
, otherwise it will load it as if it were a COM
file. Since MZ
doesn't map to a sensible x86 instruction to start a program, they can get away with this. Net effect: In some versions of DOS/Windows, an .EXE
can be named with .COM
and vice versa. For example, in many versions of DOS/Windows, the famous COMMAND.COM
was actually an EXE
.
I am not sure how much the previous paragraph applies to NT based versions of Windows. I'd imagine by now they've abandoned the .COM
stuff altogether.
Lastly, a .BAT
file is a list of commands to be executed as if you typed them at your command prompt. However these days most people name them as .CMD
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With