To write a batch file, one has to use a simple text-editor and when saving the script then give it the proper file extension ".BAT". When writing the batch file one can make use of different builtin commands:
Keyword | Functionality |
---|---|
ECHO | Displays a text string |
REM | Used to comment out a command or make a remark |
SET | Saves a value in an environment variables |
GOTO | Jumps to a :LABEL, which can be used to make loops or function calling |
IF | Allows conditional behavior |
CALL | Used for calling other batch files |
FOR | Performs a command on a collection of items |
ERRORLEVEL | Contains the returncode of an excuted program |
%1-%9 | When calling a batch one can provide parameters, which the batch file can access as environment variables |
PAUSE | Stops the execution of the batch file until the user presses a key on the keyboard |
Leave a Reply