How to use Xcopy command in Command Prompt

Knowing how to use Xcopy command in Command Prompt, you will easily use commands in Cmd professionally. In particular, the Xcopy command is extremely useful for those who copy and copy data on the computer.

1. What is the Xcopy command?

Commnad Prompt is a popular script on Windows and they are available on every version of Windows ever. As for the Command Prompt, they are an essential program on the computer and are mainly intended for those who often use commands instead of manipulation.

How to use Xcopy command in Command Prompt Picture 1How to use Xcopy command in Command Prompt Picture 1

The Xcopy command is one of the basic commands on the Command Prompt, their task is to copy one or more files from one folder to another. However, Xcopy has many different parts through the command and they are relatively complicated for the novice.

2. Xcopy command syntax

Basically, the Xcopy command has many different uses in terms of extended syntaxes. Below are the basic Xcopy commands and extended commands.

Basic Xcopy command:

xcopy 

Xcopy command with extension

xcopy 'source' 'destination' '/a' '/b' '/c' '/d [:date]' '/e' '/f' '/g' '/h' '/i' '/j ' '/k' '/l' '/m' '/n' '/o' '/p' '/q' '/r' '/s' '/t' '/u' '/v' ' /w' '/x' '/y' '/-y' '/z' '/exclude:file1[+file2][+file3].' '/?'

For the extended Xcopy command, you can choose from many different extensions, when you use it, you can remove the ' '

Extensions How it works
source Specify the file, the largest total folder you want to copy
destination Specify the location where the Source folder or file will be copied to
/a       Copy only archive files found in the Source folder
/b Use copy the symbolic link itself (symbolic link) instead of the link destination
/c Xcopy will continue to work (in case of an error)
/e Create an empty folder in Destination or Source
/f Show full path and name of file Source or Destination when copying
/g Copying encrypted files in Source to Destination does not support encryption
/H Copy hidden files or system files
/i Use to Xcopy treat Destination as a directory
/j Copy files but do not save buffer (usually used for large files)
/k Copy files and keep file properties in Destination
/l Show list of copied files and folders
/m Copy archives found in the Source folder, however the archive attribute will be turned off after copying
/n Create files and folders in Destination using short filenames (Used for FAT-formatted systems that do not support long filenames)
/o Retain all ownership and Access Control List (ACL) information in the file transferred to Destination
/p Enable notification when creating each folder in Destination
/q Put Xcopy in Quiet mode, bypassing the on-screen display for files when copying
/r Overwrite read-only files in Destination
/S Copy all folders (including subfolders, files inside) in addition to the files of the Root folder in Source
/t Let Xcopy create the directory structure in Destination but do not copy the data. This command is used to create empty directories in Destination similar to Source .
/u Copy only files in Source that are already in Destination
/v Verify each file when copying (based on total size). Usually used to compare documents after copying to see if they are the same or original
/w Enable "Press any key when ready to be copying file(s)" message when copying data
/x Check file and System Access Control List (SACL) information
/y Turn off notification when overwriting files from Source to Destination
/-y Enable prompt notification when overwriting files from Source to Destination
/z Force Xcopy to safely stop copying files (use when connection is lost) and be able to resume copying when needed.
/exclude: file1[ + file2][ + file3]. Specify a file name file containing the list of search strings that you want to use the command to specify the file or directory to ignore when copying
/?       Open support for extended commands in Xcopy.

Copy files to new folder

xcopy C:Demo E:Demo /i

How to use Xcopy command in Command Prompt Picture 2How to use Xcopy command in Command Prompt Picture 2

In the above command, Xcopy will copy all the data in the Source source (ie C:Demo) and move to the copied Destination folder (ie E:). In this case, we use the additional command '/i' to create a new directory in drive E: with the name Demo.

Confirm Before Copying

xcopy C:Demo E:Demo /w

How to use Xcopy command in Command Prompt Picture 3How to use Xcopy command in Command Prompt Picture 3

In this command, the system will pop up a confirmation message before copying any data from the Source to the Destination. To confirm before copying, you can press any key to confirm copying.

Check the original file and the file after copying

xcopy /v

How to use Xcopy command in Command Prompt Picture 4How to use Xcopy command in Command Prompt Picture 4

Checking the original file and the file after copying will be similar to checking MD5, SHA-1 on your computer. This way will help you check exactly if the file before and after Copy to the folder is the same or not.

In this article, Tipsmake showed you how to use the Xcopy command in the Command Prompt. Have a nice day!

4.7 ★ | 3 Vote

Maybe you are interested