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

59,161

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.

Share:
59,161

Related videos on Youtube

Matt
Author by

Matt

Cookie, Cookie, Cookie

Updated on September 17, 2022

Comments

  • Matt
    Matt over 1 year

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

  • ajf0
    ajf0 over 9 years
    @kokbira or you can use shift to access the rest
  • Kevin Fegan
    Kevin Fegan about 4 years
    @TWiStErRob - I'm sure you know it but to be clear... even with %* you need to use shift to access parameters beyond %9. The advantage of using %* is you can pass the entire ORIGINAL parameter list (including parameters that have been "shifted out") to an external batch or other program, or with a call :label %*, even if you don't know how many parameters are in the list (or if it's more than 9).
  • mirabilos
    mirabilos over 2 years
    Is this quoted properly, like "$@" in sh?