What are batch files

Definition: A batch file is a simple text file with a series of commands which are executed whenever the file is being run either manually with cmd.exe or automatically on a specific date and time.

Usually it is used to erase, move or archive files on a regular basis. The command lines are easy to learn and do not require advanced programming skills. Commands used in batch files are not case sensitive similarly to the MS-DOS commands.

The earliest and most used batch file is probably the autoexec.bat boot file. This file is loaded whenever the computer starts booting MS-DOS or Windows and contains all the commands the operating system requires to run properly.

Batch files can have different extensions depending on the operating system from which most often used are .bat, .cmd or .btm.

Some batch command examples:

@ or @ECHO OF – prevents echoing back the text after the symbol
CALL – this command is used whenever another batch file in the original one is needed to be run
CLS – used to clear screen just like in MS-DOS
IF – used to search for a condition and only in case it finds then will execute the function
REM – used to write comments
START – used to run Windows applications (ex. C:\Windows\NOTEPAD.EXE)

Related Posts

Share This

Leave a Comment