SHIFT Command

The SHIFT command shifts batch script arguments. This command is very useful to create batch scripts requiring many parameters.


SHIFT [/start | /s[:]start] [/d[:]step]

Changes position of parameters within the variable %0 to %9.

Displacement takes place from the the lowest parameter to the highest. If any argument is left empty by the process, then SHIFT tries to put some additional arguments using remaining arguments stored in %+. If %+ is already empty, these variables are left empty.

The content of the variable %* is not modified by the SHIFT command.


Mostly compatible with cmd.exe. Indeed, while replacing the %0 parameter, cmd.exe checks that the new argument refers to a file or a directory and if it is not, replace it by the current directory. This behaviours is not implemented by pBat.

See Also

Commands list, pBat