.BAT is an obsolete extension originally used by 16-bit versions of COMMAND.COM in DOS and Windows 95/98.
.CMD is the batch file extension for files executed by the 32-bit CMD.EXE in Windows.
If you're running Vista or Windows 7, there's no difference at all between the behavior of .BAT and .CMD files; TCC (or CMD) execute them identically.
If you're running Windows XP or earlier, a .BAT file is actually executed by the stub version of COMMAND.COM, which passes most (but not all) of the commands on to CMD.EXE. (The point of this is to allow you to run old DOS batch files that contain TSRs, which are not supported in newer versions of Windows.)
TCC handles .BAT and .CMD files the same way: one line at a time is read from the file, and the file is closed before the line is executed. That's a file open, seek, read and close for each line, which can slow a batch file down significantly, e.g. over a network connection.
.BTM files are handled differently. The entire file is slurped into memory once, saving a whole lot of file-system overhead. .BTM files can be noticeably faster. (The downside is that they can't self-modify on the fly -- a nasty technique best avoided anyway.)
For all intents and purposes they are the same. I seem to recall Rex
saying something about COMMAND.COM sends .BAT statements to CMD.EXE to
execute. And CMD files are executed directly by CMD.EXE.
Historically, .CMD files came from OS/2. When OS/NT turned into WinNT, it
just naturally supported them I suppose.
I know that execution of a .BAT file is line by line. I.e. the file is
opened, the next line is read, the file is closed. And so on. That
allows .BAT files to be self-modifying.
BTM files are read as a whole. I don't know if there are any special
execution idioms around CMD files.
Kachupp <> wrote on 10/21/2010 09:56:44 PM:
> CMD and BAT files are the same .. CMD files are executed by CMD.EXE,
> BAT files are executed by command.com
> > -----Original Message-----
> > From: CSGalloway@nc.rr.com [mailto:]
> > Sent: Friday, 22 October 2010 1:31 p.m.
> > To: firstname.lastname@example.org
> > Subject: [Support-t-2357] .CMD .vs. .BAT
> > I have RTFM but don't really understand the difference between the
> two file extensions. Would
> > someone please explain.....???
> ---End Quote---