As I understand it, .bat
is the old 16-bit naming convention, and .cmd
is for 32-bit Windows, i.e., starting with NT. But I continue to see .bat files everywhere, and they seem to work exactly the same using either suffix. Assuming that my code will never need to run on anything older than NT, does it really matter which way I name my batch files, or is there some gotcha awaiting me by using the wrong suffix?
Windows batch files: .bat vs .cmd
batch-filecmdwindows
Related Topic
- Windows – Batch file to delete files older than N days
- Windows – n equivalent of ‘which’ on the Windows command line?
- Windows – How to get list of arguments
- How to run multiple .BAT files within a .BAT file
- Windows – Redirect Windows cmd stdout and stderr to a single file
- Python – How to install pip on Windows
- Windows – How to run two commands in one line in Windows CMD
- How to “comment-out” (add comment) in a batch/cmd
Best Answer
From this news group posting by Mark Zbikowski himself:
In other words, if ERRORLEVEL is set to non-0 and then you run one of those commands, the resulting ERRORLEVEL will be: