I would like to know how to call more than 9 argument within a batch script when calling a label. For example, the following shows that I have 12 arguments assigned along with attempting to echo all of them.
CALL:LABEL "one" "two" "three" "four" "five" "six" "seven" "eight" "nine" "ten" "eleven" "twelve"
PAUSE
GOTO:EOF
:LABEL
echo %1
echo %2
echo %3
echo %4
echo %5
echo %6
echo %7
echo %8
echo %9
echo %10
echo %11
echo %12
The output for %10 %11 and %12 ends up being one0 one1 one2. I’ve tried using curly brackets, brackets, quotations, single quotes around the numbers without any luck.
Use the
shiftcommand if you want to work with more than 9 parameters.(actually more than 10 parameters if you count the
%0parameter)You can either use a loop, store the variables before shifting, or do it quick like this:
You can replace the shift commands with a loop in case you have many arguments. The following for loop executes
shiftnine times, so that%1will be the tenth argument.