.BAT Windows Batch File
.bat

Windows Batch File

A BAT file is a Windows batch script containing a sequence of commands executed by the cmd.exe command interpreter. Batch files automate repetitive tasks like file operations, program launches, and system configuration.

Binary layout
Header magic bytes
Sections code · data
x-msdos-program1981Proprietary
By FileDex
Not convertible

This format is not currently supported for conversion in FileDex.

Common questions

What is a BAT file?

A BAT file is a Windows batch script containing commands that run sequentially in the cmd.exe command interpreter to automate tasks.

How do I run a BAT file?

Double-click the BAT file in Windows Explorer, or open Command Prompt and type the file path. Right-click and choose Run as administrator for elevated privileges.

Are BAT files dangerous?

BAT files can execute any system command, so running an untrusted BAT file is risky. Always review the contents in a text editor before executing batch files from unknown sources.

What makes .BAT special

Batch files date back to MS-DOS and remain supported in all versions of Windows through the cmd.exe shell. They use a simple scripting syntax with commands like ECHO, SET, IF, FOR, GOTO, and CALL to perform sequential operations, conditional logic, and basic loops. BAT files can invoke any command-line utility, manipulate environment variables, redirect output, and chain commands with pipes. While PowerShell has largely superseded batch scripting for complex automation tasks, BAT files remain widely used for simple automation, build scripts, application launchers, and legacy system maintenance. Security software often flags BAT files because they can execute arbitrary system commands, making them a common vector for malware distribution.

Continue reading — full technical deep dive

Technical reference

MIME Type
application/x-msdos-program
Developer
Microsoft
Year Introduced
1981
Open Standard
No