There is no practical limit to the number of parameters you can pass to a batch file, but you can only address parameter 0 (%0 - The batch file name) through parameter 9 (%9).
To circumvent this behavior, you can use the SHIFT command, as in the following example:
test a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9
where test.bat might contain:
@echo off
@echo %0
:again
if \{%1\}==\{\} goto :EOF
@echo %1 %2 %3 %4 %5 %6 %7 %8 %9
shift
goto again
With the above parameters, test.bat would display:
test a b c d e f g h i b c d e f g h i j c d e f g h i j k d e f g h i j k l e f g h i j k l m f g h i j k l m n g h i j k l m n o h i j k l m n o p i j k l m n o p q j k l m n o p q r k l m n o p q r s l m n o p q r s t m n o p q r s t u n o p q r s t u v o p q r s t u v w p q r s t u v w x q r s t u v w x y r s t u v w x y z s t u v w x y z 0 t u v w x y z 0 1 u v w x y z 0 1 2 v w x y z 0 1 2 3 w x y z 0 1 2 3 4 x y z 0 1 2 3 4 5 y z 0 1 2 3 4 5 6 z 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 9 2 3 4 5 6 7 8 9 3 4 5 6 7 8 9 4 5 6 7 8 9 5 6 7 8 9 6 7 8 9 7 8 9 8 9 9
0 comments
Hide comments