Search notes:

cmd.exe batch files arguments (stored in %1, %2 etc)

The arguments that were given when a batch file was invoked are passed to the batch file in the variables %1 through %9.
%0 contains the name of batch file that was invoked
%* contains all arguments (without the name of the batch file (%0))
@echo off

echo Name of batch file: %0

echo First argument:     %1
echo Second argument:    %2

echo All arguments:      %*
Github repository about-cmd.exe, path: /batch-files/arguments/number-star.bat
C:\> number-star.bat foo bar baz
Name of batch file: arguments.bat
First argument:     foo
Second argument:    bar
All arguments:      foo bar baz

See also

The shift command does not change %*.
passing arguments to a batch file
Using the tilde (~) in script-arguments, for example to remove file name extensions
Cookbook: parsing arguments

Index