XCOPY--Notes
Default value for destination
If you omit destination, the XCOPY command copies the files to the current
directory.
Specifying whether destination is a file or directory
If destination does not contain an existing directory and does not end with
a backslash (\), XCOPY prompts you with a message in the following format:
Does destination specify a file name
or directory name on the target
(F = file, D = directory)?
Press F if you want the file(s) to be copied to a file. Press D if you want
the file(s) to be copied to a directory.
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
from 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.
XCOPY does not copy hidden and system files
In older versions of MS-DOS, XCOPY copied hidden and system files. This is
not the case in MS-DOS 6.22. To remove the hidden or system attribute from a
file, use the <ATTRIB> command.
XCOPY sets archive attribute for destination files
XCOPY creates files with the archive attribute set, whether or not this
attribute was set in the source file. For more information about file
attributes, see the ATTRIB command.
XCOPY vs. DISKCOPY
If you have a disk that contains files in subdirectories and you want to
copy it to a disk that has a different format, you should use the XCOPY
command instead of DISKCOPY. Since the DISKCOPY command copies disks track
by track, it requires that your source and destination disks have the same
format. XCOPY has no such requirement. In general, use XCOPY unless you need
a complete disk image copy. However, XCOPY will not copy hidden or system
files such as IO.SYS and MSDOS.SYS. Therefore, use DISKCOPY to make copies
of system disks.
XCOPY exit codes
The following list shows each exit code and a brief description of its
meaning:
0 Files were copied without error.
1 No files were found to copy.
2 The user pressed CTRL+C to terminate XCOPY.
4 Initialization error occurred. There is not enough memory or disk space,
or you entered an invalid drive name or invalid syntax on the command
line.
5 Disk write error occurred.
You can use the ERRORLEVEL parameter on the IF command line in a batch
program to process exit codes returned by XCOPY. For more information, see
the topic <XCOPY--Examples>.
|