.bat

What is a .bat file?

BAT is a Windows batch script — automating Command Prompt tasks, now largely replaced by PowerShell.

Use caution
Type Code
By Microsoft
MIME application/x-msdos-program

Drop any file to identify it

No upload. No signup. No sending your file halfway across the internet.
We tell you what it is, right here in your browser.

What is it

You found a .bat file — a batch script for the Windows Command Prompt. It's a plain text file containing a sequence of commands that Windows executes line by line. Batch files automate repetitive tasks: renaming files, running backups, setting environment variables, or launching applications with specific parameters.

Batch scripting dates back to MS-DOS in the 1980s and uses a syntax that reflects its age — IF/ELSE conditions with bizarre escaping rules, FOR loops that look like someone lost a fight with a keyboard, and environment variable expansion using percent signs. Despite being objectively terrible as a programming language, batch files persist because they work on every Windows machine without installing anything. PowerShell (.ps1) is the modern replacement for serious scripting.

Any text editor opens .bat files. Double-clicking runs the script in Command Prompt — which is why you should never run batch files from unknown sources. They can do anything your user account can do: delete files, modify the registry, download executables. Read the file in a text editor first if you didn't write it yourself.

Technical details
Full Name
Windows Batch File
MIME Type
application/x-msdos-program
Developer
Microsoft
Magic Bytes
N/A
Safety
.bat requires caution. Batch files can execute any system command. Never run a .bat file from an untrusted source.
What opens it
Command Prompt (execute)
FREE Windows
Any text editor
FREE All
FAQ
Are .bat files safe?
Batch files are plain text commands — they're safe to read in a text editor. Running them is a different story. A malicious .bat file can delete files, install software, or modify your system. Only run .bat files from trusted sources.
What's the difference between .bat and .ps1?
.bat is a legacy Command Prompt script with limited capabilities. .ps1 is a PowerShell script — far more powerful, with access to .NET libraries, structured data, and modern programming constructs. For new automation tasks on Windows, use PowerShell.
Related formats