Windows batch files: .bat vs .cmd?
Windows batch files: .bat vs .cmd?
731
14-Jul-2023
Updated on 15-Jul-2023
Aryan Kumar
15-Jul-2023.bat and .cmd are both file extensions for batch files in Windows. A batch file is a text file that contains a series of commands that are executed by the command prompt.
The main difference between .bat and .cmd files is that .cmd files are executed by the cmd.exe command processor, while .bat files are executed by the command.com command processor. The cmd.exe command processor is a newer version of the command.com command processor, and it has some additional features, such as the ability to run scripts that contain loops and conditional statements.
In general, you should use .cmd files if you want to take advantage of the additional features of the cmd.exe command processor. However, if you are creating a batch file that is compatible with older versions of Windows, you should use a .bat file.
Here is a table that summarizes the differences between .bat and .cmd files: