Do Windows batch files have a %* construction?

Solution 1:

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.

Solution 2:

You can gather all the args together using something like:

set args=%1
shift
:start
if [%1] == [] goto done
set args=%args% %1
shift
goto start

:done
(use %args% here)

This works regardless of how many arguments there are.