What is a batch file

A batch file is a pre-written script that when double-clicked executes its contents within the command prompt. The idea behind a batch script is to save time and avoid repeting commands as putting the code into a batch file and executing it is the same as directly putting it into the command prompt and running it there.


Batch files allow the use of loops and conditional (if) statements. They also can be called from within the command prompt.

The language is called DOS and for a quick example save the following as a .bat and double click it:

@echo Hello world.

batch file hello world example
Hello world

If you opened command prompt (CMD) and typed @echo Hello world then pressed enter you would get the same result.


As stated above batch files prevent retyping commands, using batch files to run complex or hard to remember commands like FFmpeg, youtube-dl, server start ups, monitoring and more is an efficient method.

A batch file can be seen somewhat similar to a function, you write them out once and use configurable values to reuse. You dont need to retype out the whole command, even better if you use variables so your command can easily be addapted.

Here is a batch file that starts and then restarts a Dayz Server based on a loop and timing.

CMD commands are in the plenty, See the full list of commands here.