Search code examples
windowsshellbatch-filewindows-shell

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


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 ?


Solution

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