oem.hlp (Table of Contents; Topic list)
SHIFT--Example
Syntax  Notes
────────────────────────────────────────────────────────────────────────────
 
                               SHIFT──Example
 
The following batch file, MYCOPY.BAT, shows how to use the SHIFT command
with any number of parameters. It copies a list of files to a specific
directory. The parameters are the directory name followed by any number of
filenames.
 
    @echo off
    rem MYCOPY.BAT copies any number of files
    rem to a directory.
    rem The command uses the following syntax:
    rem mycopy dir file1 file2 ...
    set todir=%1
    :getfile
    shift
    if "%1"=="" goto end
    copy %1 %todir%
    goto getfile
    :end
    set todir=
    echo All done
 
                                      ♦