SHIFT

The description below is from the book
DOS the Easy Way by Everett Murdock Ph.D.

CLICK HERE for information about downloading the book.

Type: Internal (2.0 and later)

Syntax:

SHIFT

Purpose: Increases number of replaceable parameters to more than the standard ten for use in batch files.

Discussion

Usually, you can only enter up to ten parameters at the time you start a batch file (%0 through %9). Use this command to shift the assignable parameters to make room for the use of additional entries.

For more information on SHIFT and other batch commands, see Chapter 5, Using Batch Files, in the downloadable book DOS the Easy Way .

Example

If you started a batch file named GO.BAT by entering the following on the command line:

go X1 X2 X3 X4 X5 X6 X7 X8 X9 X10

the parameters available for use in the batch file GO will be set as follows:

%1 = X1
%2 = X2
%3 = X3
%4 = X4
%5 = X5
%6 = X6
%7 = X7
%8 = X8
%9 = X9

To use the additional parameter you entered on the command line (X10), enter

shift

The parameters will be reset as

%1 = X2
%2 = X3
%3 = X4
%4 = X5
%5 = X6
%6 = X7
%7 = X8
%8 = X9
%9 = X10

The set parameters are shifted one higher, giving you access to more than ten parameters. Each time you enter the SHIFT command, the parameters used by the batch file are shifted up one position.




Back to the Easy DOS Command Index