Published on: 1 June, 2022

Discuss the differences between command file and executable file.


Both files are commonly found in a program’s root installation directory and both run programs when opened. Often, they even have the same Windows icon. To the average user, .BAT and .EXE files appear nearly identical. BAT files are simple text scripts, and can be created and modified in text editor programs such as Microsoft Notepad or WordPad. The language used by BAT files is not too difficult to learn, especially for simple scripting purposes. An easy way to create a BAT file is to first create a .TXT file, save it, and then change its extension to ".bat." You can reopen the new BAT file directly in text editor program to change the code. However, be careful not to double-click a BAT file assuming that it will open in a text editor, because Windows may execute the code instead.

When a BAT file is run, the code is executed by a Windows built-in utility called the Windows Command-Line Interpreter (CLI). This is a "shell" program that allows users to type and execute DOS-like commands. When the Windows CLI executes a BAT file, each command is executed sequentially until all commands are completed. Interestingly, in contrast to EXE files, BAT files are actually run by an EXE program with the name cmd.exe.

Random questions