The well-know shift command can be used to shift positional parameters in batch file, BUT it does not affect the special variable %*.
The shift command has no effect on the %* batch parameter.
Is there an alternative for shifting %°?
The well-know shift command can be used to shift positional parameters in batch file, BUT it does not affect the special variable %*.
The shift command has no effect on the %* batch parameter.
Is there an alternative for shifting %°?
Unfortunately, no, there is no built in syntax to do what you want. The best you can do is use a loop to build a variable containing the desired list of parameters. Each iteration adds %1 to the list and then shifts. The loop continues until there are no more parameters.
This will only work if the parameters do not contain any unquoted poison characters.
@echo off
shift /1
shift /1
set "remainingArgs="
:getRemainingArgs
if "%~1" neq "" (
set ^"remainingArgs=%remainingArgs% %1"
shift /1
goto :getRemainingArgs
)
echo remainingArgs=%remainingArgs%