3

Possible Duplicate:
Windows batch files: .bat vs .cmd?

I know that the .cmd is the successor of the .bat (.cmd files use 32-bit execution while the .bat files use 16-bit execution) but most repositories I see on github that have a build script for windows continue using .bat extensions for build files.

As a general rule, anything you can do in a .bat file you can do in a .cmd file, but the reverse is usually not true.

There is a reason to use .bat instead of .cmd for build files?

Edit:

To clarify the difference between the extensions: Windows batch files: .bat vs .cmd?

Community
  • 1
  • 1
Acaz Souza
  • 7,495
  • 11
  • 49
  • 94
  • How did you come to know that `.cmd` is the successor of `.bat`? – Chris Morgan Feb 17 '12 at 12:20
  • May be they are not aware of ".cmd". I heard it from you for the first time...;) – Shashank Kadne Feb 17 '12 at 12:22
  • @ChrisMorgan http://stackoverflow.com/questions/148968/windows-batch-files-bat-vs-cmd – Acaz Souza Feb 17 '12 at 12:22
  • So is this not a duplicate of that same question you posted the link to? – tpg2114 Feb 17 '12 at 12:23
  • @AcazSouza: this question is just a straight duplicate of that... but still, I wouldn't consider "successor" an appropriate term. They coexist just fine; people know of `.bat` and may be confused by `.cmd`, so even if you know of `.cmd` it may be best to avoid it for other people's sake. As you may imagine, this is self-perpetuating. But is that a problem? I think not. – Chris Morgan Feb 17 '12 at 12:25
  • No, i want to know if have a reason to why people use .bat files instead of .cmd files. See build files in repositories in github, almost always use .bat files. – Acaz Souza Feb 17 '12 at 12:25
  • @ChrisMorgan (The CMD extension is limited to newer Windows systems and is not recognized in Windows 9x/Me systems. In Windows XP, Vista, and 7 there is little practical difference between the two extensions.) Font: http://commandwindows.com/batch.htm This is true? – Acaz Souza Feb 17 '12 at 13:29

1 Answers1

1

Two reasons come to mind:

  1. cmd files have not been well publicised and I suspect a majority of people who use batch files do not know of their existance. I did not and I use batch files on a regular basis, and have for close to 15 years.
  2. Of those that do know, batch files have the benefit of being backwards compatible. There is not a lot of direct benefits to using cmd files but allowing the same batch file to be run on practically any version of Windows and even DOS without any changes.
dlanod
  • 7,715
  • 7
  • 49
  • 89