Switches That You Can Use with Xcopy and Xcopy32 Commands (289483)



The information in this article applies to:

  • Microsoft Windows Millennium Edition
  • Microsoft Windows 98 Second Edition
  • Microsoft Windows 98
  • Microsoft Windows 95

This article was previously published under Q289483

SUMMARY

The xcopy and the xcopy32 commands have the same switches. This article describes the switches that available when you run the commands outside of Windows (in MS-DOS mode), and when you run the commands from an MS-DOS window.

MORE INFORMATION

The following command line includes the syntax and the switches that you can use with the xcopy and the xcopy32 commands in MS-DOS mode:

xcopy source [destination] [/a | /m] [/d:date] [/p] [/s] [/e] [/v] [/w]

NOTE: The square brackets ([]) indicate optional switches. The brackets are not part of the command.

The following table describes the optional switches you can use with xcopy and xcopy32:

sourceSpecifies the file to copy.
destinationSpecifies the location and the name of new files.
/aCopies files with the archive attribute set. This switch does not change the attribute.
/mCopies files with the archive attribute set, and turns off the archive attribute.
/d:dateCopies files changed on or after the specified date.
/pPrompts you before creating each destination file.
/sCopies folders and subfolders except empty ones.
/eCopies any subfolder, even if it is empty.
/vVerifies each new file.
/wPrompts you to press a key before copying.


WARNING: Long file names are not retained in MS-DOS mode.

NOTE: In Windows Millennium Edition (Me) only, an /h switch is added to the xcopy and the xcopy32 commands. This switch copies hidden and system files in MS-DOS mode. However, the Xcopy files are not automatically included on the Windows Me boot disk.

The following command line includes the syntax and the switches for the xcopy and the xcopy32 commands when you run it from an MS-DOS window:

xcopy source [destination] [/a | /m] [/d:date] [/p] [/s] [/e] [/w] [/c] [/i] [/q] [/f] [/l] [/h] [/r] [/t] [/u] [/k] [/n]

NOTE: The square brackets ([]) indicate optional switches. The brackets are not part of the command.

The following table describes the optional switches you can use with xcopy and xcopy32 when you run the command in an MS-DOS window:

sourceSpecifies the file to copy.
destinationSpecifies the location and the name of new files.
/aCopies files with the archive attribute set. This switch does not change the attribute.
/mCopies files with the archive attribute set, and turns off the archive attribute.
/d:dateCopies files changed on or after the specified date.
/pPrompts you before each destination file is created.
/sCopies folders and subfolders except for empty ones.
/eCopies any subfolder, even if it is empty.
/wPrompts you to press a key before copying.
/cContinues copying even if errors occur.
/iIf the destination does not exist, and you are copying more than one file, this switch assumes that the destination is a folder.
/qDoes not display file names while copying.
/fDisplays full source and destination file names while copying.
/lDisplays files that are going to be copied.
/hCopies hidden and system files.
/rOverwrites read-only files.
/tCreates a folder structure, but does not copy files. Does not include empty folders or subfolders. Use the /t with the /e switch to include empty folders and subfolders.
/uUpdates the files that already exist in that destination.
/kCopies attributes. Typical xcopy commands reset read-only attributes.
/yOverwrites existing files without prompting you.
/-yPrompts you before overwriting existing files.
/nCopies using the generated short names.

Modification Type:MinorLast Reviewed:1/14/2006
Keywords:kbinfo KB289483