source
Specifies which files
to copy. You can use wildcard characters to define the file
specification. See the "Working with Wildcard Characters" sidebar for
details. The file specification can also include a drive and absolute or
relative path.
destination
Specifies the destination for the files. When working with a single file, you can also specify a new filename for the file.
/A
Copies only the
files with the archive attribute set. Copying the files doesn't change
the attribute status, so you need to use the Attrib utility to change the archive bit. Some people use this particular feature to
create a simple, but effective, backup utility. They send any changed
files to a hard drive on another machine, and then clear the archive
attribute. As an alternative, if you know the copying methodology works
without flaw, you can use the /M command line switch.
/M
Copies only the files with the archive attribute set. However, unlike the /A command line switch, this command line switch does reset the archive bit.
/D[:
Month-Day-Year]Copies files
changed on or after the specified date. When you leave out the date,
then XCopy only copies the file when the date of an existing file in the
destination is older than the source file. If the dates are the same or
newer, then XCopy doesn't copy the file.
/EXCLUDE:
Definition1[+Definition2][+ Definition3]...Excludes files or directories based on the strings you provide. For example, specifying .TXT as a string excludes all text files from the copy. On the other hand, specifying a string such as \MyDir excludes the entire \MyDir
subdirectory from the copy. You can make strings ambiguous to describe a
number of conditions. For example, including the string My would exclude files or directories with the word My
in them as any part of the name, including the extension. You can
create multiple excludes by separating each exclude string with a plus
sign (+).
/P
Prompts the user before creating each destination file.
/S
Copies all
files in the current directory, plus all subdirectories and their files
except empty subdirectories. You can't use this command line switch to
create an empty directory structure for a user or application; use the /E command line switch instead.
/E
Copies all files in the current directory, plus all subdirectories and their files including empty subdirectories.
/V
Verifies each new file as the system writes it. This command line switch overrides the system verify setting.
/W
Waits for the user
to insert a floppy disk or other removable media before beginning the
copy process. Generally, you'd use this option as part of a batch file
where the copying process requires more than one disk.
/C
Forces XCopy to continue copying files even when an error occurs. Normally, XCopy stops when it encounters the first copy error.
/I
Forces XCopy to
assume the destination is a directory when the destination doesn't exist
and you're copying more than one file. Otherwise, XCopy displays a
message asking the user whether the destination is a file or a
directory. This will cause a batch file to halt to wait for user
participation.
/Q
Copies the
files without displaying the filenames. You can use this option in a
batch file where you don't necessarily want the user bothered or aware
of everything that's happening in the background.
/F
Displays full
source and destination filenames while copying, including both the
drive and the path. Normally, XCopy displays only the filenames. This
feature often comes in handy when diagnosing problems with complex batch
files because it shows precisely where XCopy copies each file.
/L
Displays a list of
files that XCopy would copy, without actually copying them. This is a
diagnostic mode where you can log the files and verify that the command
line syntax produces the desired result.
/G
Copies
encrypted files to a destination that doesn't support encryption. This
is a Windows-specific command line switch. The resulting destination
files are unencrypted when you complete the copy, so using this command
line switch can result in a security hole in your system.
/H
Copies any files
marked hidden or system. Normally, XCopy only copies the files without
these attributes since hidden and system files are normally associated
with operating system requirements (they aren't data files).
/R
Forces XCopy to overwrite read-only files. Normally, XCopy won't overwrite read-only files to preserve their content.
/T
Creates the
directory structure, but doesn't copy any of the files. You can use this
feature to create an empty directory structure for a new user or
application without compromising data that might appear in an existing
pattern directory structure. This command line switch won't include
empty directories and subdirectories in the source. To include the
complete directory structure in the destination, combine the /T and /E command line switches.
/U
Copies only the
source files that already exist in the destination. You could use this
feature to perform updates on another system without compromising any
unique files in the source system.
/K
Copies all of the file and directory attributes. XCopy normally resets some of the attributes, such as read-only.
/N
Creates a
destination file with an 8-character filename and a 3-character file
extension. Use this command line switch when you must create destination
files for older systems that rely on the DOS 8.3 naming convention.
Avoid using this command line switch on files with long filenames unless
you really do want to create a compatible file.
/O
Copies the file
ownership and Access Control List (ACL) information. The ACL provides
security for the file. If you don't use this command line switch, the
destination system uses the default security settings for that system,
which might not provide sufficient security for sensitive data.
/X
Copies the
file audit settings in addition to the file ownership and ACL
information. File auditing monitors each file as Windows opens, closes,
or modifies it. Using file auditing helps you track user and system
activities, but does cause a performance hit.
/Y and /-Y
Suppresses or
enforces the prompt for overwriting destination files with the same name
as the destination file provided as input to the XCopy command. Use the
/Y command line switch in batch files where you know the batch file will overwrite an existing destination file. The /-Y command line switch is the default, so you never need to use it.
/Z
Copies networked files in restartable mode. If the copy process stops for any reason, XCopy attempts to restart the file copy.
/B
Copies
a symbolic link to the target instead of the actual file pointed to by
the symbolic link when the source is a symbolic link.