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. @pause
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.
A drained and empty Kennington reservoir images from a drone in early July 2024. The…
Merrimu Reservoir from drone. Click images to view larger.
Using FTP and PHP to get an array of file details such as size and…
Creating and using Laravel form requests to create cleaner code, separation and reusability for your…
Improving the default Laravel login and register views in such a simple manner but making…
Laravel validation for checking if a field value exists in the database. The validation rule…