When a batch file is run, it gives you the option to pass in command line parameters which can then be read within the program for further processing. The batch files parameters can be recalled from within the program using the % operator along with the numeric position of the parameter. Following is how the command line parameters are defined.
Let’s take a look at a simple example of how command line parameters can be used.
@echo off echo The first parameter is %1 echo The second parameter is %2 echo The third parameter is %3
If the above code is stored in a file called test.bat and the file is run as
test.bat 5 10 15
then, following will be the output.
The first parameter is 5 The second parameter is 10 The third parameter is 15