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.
MOVE--Notes
Examples  Syntax
────────────────────────────────────────────────────────────────────────────
 
                                MOVE──Notes
 
Renaming a file while moving it
 
If you move only one file to a new directory, you can rename the file as you
move it by specifying the new filename in the destination. However, if you
move more than one file to a new directory in the same command line, you
cannot specify a filename as a destination. If you specify a destination
filename and the file already exists, MOVE will overwrite the existing file
without prompting you.
 
If you specify a filename when moving more than one file, you will see the
following message:
 
    Cannot move multiple files to a single file
 
Renaming a directory using the MOVE command
 
You can rename a directory using the MOVE command. Specify the old directory
name as the file you want to move, and then specify the new directory name
as the destination. You can change the directory name, but you cannot move
the directory to another location in the directory tree.
 
For example, to rename a directory called NEW on drive C to OLD, type the
following command:
 
    move c:\new c:\old
 
The following command is invalid because the new directory name is not in
the same location as the old directory name:
 
    move c:\new c:\dos\new
 
When you issue this command, MS-DOS displays the following error message:
 
    c:\new => c:\dos\new [Unable to open source]
 
Setting the COPYCMD environment variable
 
You can set the COPYCMD environment variable to specify whether you want the
COPY, MOVE, and XCOPY commands to prompt you for confirmation before
overwriting a file in all cases, whether issued from the command prompt or a
batch file.
 
To force the COPY, MOVE, and XCOPY commands to prompt you before overwriting
in all cases, set the COPYCMD environment variable /-Y. To force these
commands to overwrite in all cases without prompting you, set the COPYCMD
environment variable to /Y.
 
Typing any of these commands with the /Y or /-Y switch overrides all
defaults and the current setting of the COPYCMD environment variable.
 
Errorlevel parameters
 
If the MOVE command successfully moved the file or files you specified, it
returns an ERRORLEVEL value of 0. If there was an error in moving one or
more of the files you specified, the MOVE command returns an ERRORLEVEL
value of 1.
 
                                      ♦