Windows – Do Windows batch files have a %* construction

batch-filescriptingwindows

In a batch file, do I have to do (e.g.) the following?

@echo off
call other.bat %1 %2 %3 %4 %5 %6 %7 %8 %9

Best Answer

Windows batch files (since Windows XP, but possibly earlier) support the %* construct, which evaluates to all the parameters from %1 onwards.

Unfortunately, this doesn't honour the SHIFT command, so the following won't work:

@echo off
set EATEN=%1
shift

call other.bat %*

It'll still pass the first parameter on to the second batch file.