help.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
SHIFT--Notes
Example  Syntax
────────────────────────────────────────────────────────────────────────────
 
                                SHIFT──Notes
 
How the SHIFT command works
 
The SHIFT command changes the values of the replaceable parameters %0
through %9 by copying each parameter into the previous one. In other words,
the value of %1 is copied to %0, the value of %2 is copied to %1, and so on.
This is useful for writing a batch file that performs the same operation on
any number of parameters.
 
Working with more than 10 command-line parameters
 
You can also use the SHIFT command to create a batch file that can accept
more than 10 parameters. If you specify more than 10 parameters on the
command line, those that appear after the tenth (%9) will be shifted one at
a time into %9.
 
Shifting parameters back
 
There is no backward SHIFT command. Once you carry out the SHIFT command,
you cannot recover the first parameter (%0) that existed before the shift.
 
                                      ♦