Change the position of command line parameters in a batch file.

SHIFT [/n]for example:
given &qt;1=one, &qt;2=two, &qt;3=three…
will result in &qt;1=two, &qt;2=three

alternatively given &qt;1=one, &qt;2=two, &qt;3=three…
will result in &qt;1=three

/n tells the SHIFT command to start shifting at the nth argument, where n may be between zero and eight.

for example:
given &qt;1=one, &qt;2=two, &qt;3=three, &qt;4=four…
will result in &qt;1=one, &qt;2=three, &qt;3=four

&qt;0 is the name of the batch file itself – &qt;1 can be shifted into &qt;0

Relative pathnames

The parameter &qt;0 will initially refer to the path that was used to execute the batch – this could be MyBatch.cmd if in the current directory or a full path like C:appsmyBatch.cmd

When SHIFT is used to move a text parameter into &qt;0 then references to &qt;0 will refer to the current working directory, unless those parameters happen to contain a valid path.

For example:


will run the executable from the same directory

If the following parameter is passed to myBatch.cmd

myBatch.cmd D:utils

Then the following commands in myBatch will run MyExecutable.exe from the directory D:utils


If Command Extensions are disabled, the SHIFT command will not support the /n switch