I'd like to find Windows batch counterpart to Bash's "$@" that holds a list of all arguments passed into script.
Or I have to bother with "shift"?
I'd like to find Windows batch counterpart to Bash's "$@" that holds a list of all arguments passed into script.
Or I have to bother with "shift"?
You can use %1, %2
etc to access the command line arguments. I don't think there's a variable that holds the entire list. You might be able to write a simple loop that determines how many arguments were passed.
EDIT: Apparently there is :)
dancavallaro has it right, %*
for everything. You might also find these useful:
%0
- the name of the batch file itself
%1
is the first command line parameter,
%2
is the second command line parameter,
and so on till %9
(and SHIFT
can be used for those after the 9th).
%~dpnx0
- is the fully qualified path name of the script (d:\scripts\some-batch.bat)
%~dp0
- drive and path to the script (d:\scripts)
More info examples at http://www.ss64.com/nt/syntax-args.html and http://www.robvanderwoude.com/parameters.html