Possible Duplicate:
Windows batch files: .bat vs .cmd?
Hi,
I am learning Windows Batch programming and come across this question:
What's the difference between .bat and .cmd file?
If they are the same, why need 2 of them?
BTW, what's the difference between command.com and cmd.exe ?
CMD files have the current version of Microsoft language while BAT has the older version of the Microsoft language. CMD is backward compatible while BAT is not backward compatible. CMD runs in most command.com scripts whereas BAT by itself will not run in command.com scripts unless made to do so.
Quick note: While batch files typically use the . bat file extensions, you can also find them using the . cmd or . btm file extensions.
A bat(ch) file is a script that is executed by the command interpretor. A exe file is compiled binary code to be executed directly on the cpu. A com file is a relic from the past to create a small exe.
A CMD file consists of a script containing one or multiple commands in the form of plain text that are run in order to execute various tasks. It is similar to a BAT file, which is also generally used to store a batch of executable commands. The CMD files are widely used in the Microsoft Windows operating system.
.bat
files are left-overs from DOS. .cmd
files are for Window NT command processor or higher, and have more capabilities (some looping structures, the ability to call and return from procedural type blocks).
command.com
was what ran the operating system and contained the internal commands like dir
in DOS and early versions of Windows. It was replaced by cmd.exe
when Windows NT was introduced, and was the first 32-bit command processor.
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