Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between *.bat and *.cmd file? [duplicate]

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 ?

like image 760
smwikipedia Avatar asked Mar 18 '11 02:03

smwikipedia


People also ask

Is .CMD and .bat the same?

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.

Is .CMD a batch file?

Quick note: While batch files typically use the . bat file extensions, you can also find them using the . cmd or . btm file extensions.

What are the * technical * Differences between .com .EXE and .BAT files?

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.

What does a .CMD file do?

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.


1 Answers

.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.

like image 84
Ken White Avatar answered Oct 04 '22 13:10

Ken White