.BAT

Файл BAT

Windows Batch File
Задать вопрос
БЫСТРЫЙ ОТВЕТ

A BAT file is a plain-text Windows batch script containing Command Prompt commands that run in sequence the moment you double-click it. To read what it does first, right-click and choose Edit to open it in Notepad -- this does not execute anything. Only run a .bat file you wrote or fully trust, because it runs with your user privileges and is a common malware delivery method.

Разработчик: Microsoft Категория: Исполняемые файлы MIME: application/x-bat
ОТКРЫВАЕТСЯ НА Windows macOS Linux
Связанные: .APK · .EXE · .VBS · .JAR

На этой странице

Проиндексировано расширений: 19k+
Последняя проверка: Jun 25, 2026

Не знаете, что это за файл?

Перетащите любой файл в наш идентификатор - мы прочитаем первые байты, чтобы определить формат.

Идентифицировать файл

Что такое формат файла BAT?

.bat is the extension for DOS batch files run from the Windows command shell, cmd.exe.

Contents of .bat files

.bat files contain commands for the command shell. Batch files let users automate tasks and run multiple commands in sequence, manage applications, or control computer resources. A well-known example is AUTOEXEC.BAT, located in the root folder of the system drive on Windows 95, 98 and Me; commands in that file executed automatically at system start to launch applications and modify default settings. Today .bat files remain fully supported on all Windows versions; their close sibling, .cmd, is the Windows NT-era equivalent with command extensions enabled by default.

Can I open .bat files?

.bat files store commands in plain text and can be edited with any text editor. However, users should take care in how they open .bat files - by default, double-clicking a .bat file automatically loads it into memory and executes its commands. Right-clicking the file and selecting Edit from the context menu lets users modify the .bat file without running its instructions. For more capable scripting, PowerShell scripts (.ps1) are the modern Windows alternative.

Can a .bat file be dangerous?

Keeping in mind that commands saved in .bat files can let the system run virtually any operation, access system resources, or install software, the risk that such files can be used to install potentially dangerous software or even destabilize the machine is real. Therefore it is recommended that users not run .bat files from unknown sources. Best practices recommend that before running any .bat file users should review its contents - even files that have been on the machine for a long time. A malicious program might have modified one or more harmless .bat files in a way that running them now causes damage to the system or installs malicious software.

Безопасность и защита

РИСК: HIGH

A .bat file is EXECUTABLE: double-clicking runs every command immediately with your user privileges - it can delete files, change settings, download and launch other programs, or disable security tools. It is a common malware vector, frequently obfuscated or used as a 'dropper' that fetches a real payload, and is often disguised as a helpful 'fix', 'crack' or 'optimizer'. SAFE HANDLING: never double-click an untrusted .bat. To inspect it, right-click to Edit (or open in Notepad/Notepad++/VS Code) and READ the commands - opening in an editor does NOT execute them. Red flags inside: commands that call powershell/curl/bitsadmin to download files, base64/garbled strings, attempts to disable Defender, or writes to system folders and the registry. If unsure, upload the file to VirusTotal (it's text, so it's safe to upload) and run it only inside a VM/sandbox.

Детали формата

в двух словах
ПОЛНОЕ НАЗВАНИЕWindows Batch Fileтакже известен как Batch script, DOS batch file
РАЗРАБОТЧИКMicrosoftс 1981 (MS-DOS 1.0; AUTOEXEC.BAT since MS-DOS / PC DOS)
MIME-ТИПapplication/x-bat
ТИПPlain-text script of Command Prompt (cmd.exe) commands, executed line by line
СВЯЗАННЫЕ.apk.exe.vbs.jar

Программы, открывающие файлы BAT

Windows6 apps
Sublime Text Платно Open as text for editing with batch syntax highlighting.
PSPad Бесплатно Free programmer's editor - opens and highlights .bat for inspection/editing.
Notepad Открытый код Open the file (or right-click to Edit with Notepad++) for syntax-highlighted, read-only inspection before running.
Notepad (Edit, do not run) Встроенная Right-click the .bat to Show more options to Edit - opens in Notepad so you can READ the commands without executing them.
Visual Studio Code Бесплатно Open the .bat as text; batch syntax highlighting makes obfuscated/malicious lines easier to spot.
Command Prompt (cmd.exe) - to RUN Встроенная Only when trusted: open cmd, type the path to the .bat and press Enter. Running from a prompt keeps the window open so you see output and errors.
macOS2 apps
Any text editor (TextEdit, VS Code) Бесплатно macOS can only READ a .bat as text - it cannot run Windows batch commands. Open it to inspect; run it on Windows (or in a Windows VM).
Parallels Desktop (to run, via Windows) Платно Runs a Windows VM on Mac; execute the .bat inside that Windows guest, not in macOS.
Linux1 app
Any text editor Бесплатно Linux reads .bat as text only; cmd.exe syntax doesn't run natively. Inspect here, run on Windows (Wine's cmd handles simple scripts imperfectly).

Технические подробности

глубокая спецификация
Execution enginecmd.exe (Windows Command Processor) - the shell reads and executes each line sequentially at runtime
File encodingANSI / Windows-1252 or ASCII; UTF-8 is accepted but a BOM (EF BB BF) at the very start breaks the first command
Magic bytes / signatureNone - plain text identified by the .bat extension only; most files begin with the line @echo off
Comment syntaxREM keyword (official) or :: (a double-colon label trick widely used as a single-line comment)
Variable syntax%VARIABLE_NAME% for environment variables; %1-%9 for positional parameters passed on the command line; %* for all arguments
Control flow constructsLabels (:name), GOTO, CALL (subroutines or child scripts), IF / ELSE, FOR loops, SETLOCAL / ENDLOCAL scoping
Error handlingERRORLEVEL pseudo-variable; IF ERRORLEVEL n checks; && and || conditional execution operators (requires command extensions)
Typical file size100 bytes to ~50 KB - from a few lines to a lengthy automation script
Sibling format.cmd is the Windows NT-era counterpart; command extensions are on by default, giving more reliable ERRORLEVEL and FOR /F behavior
Code signingNo native signature mechanism - unlike PowerShell .ps1 scripts, .bat files cannot be digitally signed or policy-restricted by execution policy
Security behaviour on executionDouble-clicking runs the file immediately without any preview; files downloaded from the internet receive a Mark-of-the-Web flag that triggers a SmartScreen prompt
Superseded byPowerShell (.ps1) for modern Windows automation, though .bat / .cmd remain fully supported and in widespread use
Associated platformsWindows (all versions), MS-DOS (origin), OS/2 (limited compatibility)
MIME typeapplication/x-bat (also encountered as application/bat, application/x-msdos-program, and text/plain)
Выпущен1981 (MS-DOS 1.0; AUTOEXEC.BAT since MS-DOS / PC DOS)
Последняя версияNo versioned spec; behavior tied to the cmd.exe of the Windows release (Windows 11 cmd as of 2026). .cmd is the NT-era sibling.
Спецификацияlearn.microsoft.com

Конвертации BAT

Вопросы и ответы сообщества

спрошено пользователями
Задать быстрый вопрос
Получите помощь от людей, работающих с файлами BAT. Будьте конкретны - укажите вашу систему и версию ПО.
Аккаунт не нужен · ответы обычно в течение дня

Вопросов пока нет - станьте первым, кто спросит о файлах BAT.

Часто задаваемые вопросы

Is it safe to open a BAT file?
Opening it in a text editor to READ it is safe - that doesn't run anything. Double-clicking it RUNS the commands, which is risky for files you don't trust. Always inspect first via right-click to Edit.
How do I see what a .bat file does without running it?
Right-click the file, choose 'Show more options' then 'Edit' (or open it in Notepad++/VS Code). You'll read the commands as plain text without executing them.
How do I run a BAT file?
Double-click it, or open Command Prompt and type the full path to the file. Running it from a prompt keeps the window open so you can read its output and any errors.
How do I convert a BAT file to EXE?
Use a wrapper like the free Bat To Exe Converter or Windows' built-in IExpress. This bundles the script into a self-extracting EXE; it doesn't compile or speed it up, and antivirus may flag the result.
What's the difference between .bat and .cmd?
They're almost identical Windows batch scripts. .cmd is the newer NT version with 'command extensions' on by default; .bat keeps some DOS-era behavior. Use either - most scripts run the same.
Why does my antivirus flag a .bat file?
Because batch files can run arbitrary commands and are a common malware tool. A flag doesn't always mean infection, but inspect the contents in an editor and only run it if you trust the source.
Can a .bat file run on Mac or Linux?
No - batch files use Windows cmd.exe syntax. On Mac/Linux you can only read them; to run one you'd need Windows or a Windows VM.

Ссылки

1Microsoft Learn - Windows commands referencelearn.microsoft.com
2Microsoft Learn - cmd.exe documentationlearn.microsoft.com

Узнать больше

по всей базе данных

Популярные расширения на этой неделе

1.AQQAQQ Instant Messenger File
2.CRDOWNLOADChrome Partial Download File
3.PARTPartial Download File
4.DATProgram Data File (generic)
5.EXEWindows Executable (Portable Executable)
6.BINCD/DVD Disc Image (BIN/CUE)
7.NOMEDIAAndroid No-Media Marker File
8.RPMSGRestricted Permission Message
9.TMPTemporary File
10.MDMarkdown Document

Похожие расширения

.APKAndroid Package
.EXEWindows Executable (Portable Executable)
.VBSVBScript file (Visual Basic Script)
.JARJava Archive
.EX4MetaTrader 4 Compiled Program (Expert Advisor / Indicator / Script)
.APPXMicrosoft Windows App Package (AppX)

Бесплатные инструменты для файлов

Идентификатор файлов и конвертер изображений в браузере - все работает на вашем устройстве.

Открыть инструменты

Обзор расширений файлов A-Z