Does %* in batch file mean all command line arguments?

Does %* in batch file mean all command line arguments?

2 Answers

Yes. According to the official Microsoft documentation:

The %* batch parameter is a wildcard reference to all the arguments, not including %0, that are passed to the batch file.

4

Besides this, a comment by @kobkira notes that you can take only up to 9 arguments in conventional syntax. Like this if you want to get n number of arguments in separate array style variables, use this syntax:

@echo off & setlocal enabledelayedexpansion & set "n=30"
for /l %%a in (1,1,%n%) do ( for /f "tokens=%%a delims= " %%b in ('echo %*') do ( set "arg[%%~a]=%%~b" )
)

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like