How to clone drive using xcopy/DOS

The following command can be used to copy the contents from one drive to another on a Windows computer.

Note –

  • this is a file/folder level copy – NOT a partition/drive level copy
  • this command will not erase the content on either drive, it will however write over content on the ‘to’ drive if it already exists.
  • you may experience issues with copy content between two different file systems – e.g. from an NTFS drive to a FAT32 drive – to avoid issues ensure both drives are using the same file system.

To use open up the command prompt (Windows key + R then type cmd) and run the command (making sure to replace d:\ and e:\ with your ‘from’ and ‘to’ drive letters).

xcopy d:\ e:\ /h/i/c/k/e/r/y

What does this command do?

This command uses the ‘xcopy’ program which has many more built in options than the old ‘copy’ program.

Here’s a break down of what the parameters are doing:

  • /h – Copy hidden and system files and folders
  • /i – If in doubt always assume the destination is a folder e.g. when the destination does not exist.
  • /c – Continue copying even if an error occurs.
  • /k – Copy attributes. XCOPY will otherwise reset read-only attributes.
  • /e – Copy folders and subfolders, including Empty folders.
  • /r – Overwrite read-only files.
  • /y – Suppress prompt to confirm overwriting a file.

Reference: http://ss64.com/nt/xcopy.html