How to Copy Files in Command Prompt

This article shows you how to use Windows Command Prompt to copy files or folders.

Prepare before copying

Picture 1 of How to Copy Files in Command Prompt

Determine the location of the file. You need to know the file's location - also known as the path - so Command Prompt knows where to find the file.

You can find the file's path by going to the file's location in File Explorer and clicking the path bar near the top of the window.

Most files have the following path: [Drive name]:Users[User name] (For example "C:UsersKhanh"). This is the path to the location where most files created by computer users are saved.

The file saved on the computer screen related to the above example will be "C:UsersKhanhDesktop", while the file in the Documents folder will have the path "C:UsersKhanhDocuments"

Picture 2 of How to Copy Files in Command Prompt

Remember file names. If you want to copy a file, you need to know the name of the file. Note, file names in Command Prompt are case sensitive, so you need to enter the exact spelling of each character.

Picture 3 of How to Copy Files in Command Prompt

Open Start by clicking the Windows icon in the bottom left corner of the screen.

Picture 4 of How to Copy Files in Command Prompt

Type command promptto find the Command Prompt program on your computer.

Picture 5 of How to Copy Files in Command Prompt

Click Command Prompt at the top of the Start window to open this program.

Note, you cannot access Command Prompt if you are using a shared computer (such as a computer at school or in a public place).

Copy files

Picture 6 of How to Copy Files in Command Prompt

Enter the command "change path". Type cdin a space, but don't press it ↵ Enterright away.

Picture 7 of How to Copy Files in Command Prompt

Enter the path of the file. This is the step to enter the path to the file to copy.

Picture 8 of How to Copy Files in Command Prompt

Click ↵ Enterto ask Command Prompt to access the path you just entered.

Picture 9 of How to Copy Files in Command Prompt

Enter the "copy" command by typing copyand a space, but don't rush to press ↵ Enter.

Picture 10 of How to Copy Files in Command Prompt

Enter a file name. You will enter the file name followed by a space, don't forget to enter the file extension (such as .txtfor text files). Do not press ↵ Enterafter this step.

If there are spaces in the file name, you need to enclose the space in quotation marks. For example, the file name "Bai tap Toan.txt" will become Bai" "tap" "Toan.txtin Command Prompt.

Picture 11 of How to Copy Files in Command Prompt

Enter the path to the destination folder. Enter another path (such as C:Users[tên của bạn]Desktop) of your choice to save the file to copy.

If you don't do this, the file will be copied to the user folder (e.g. "C:Users[your name]") by default.

Picture 12 of How to Copy Files in Command Prompt

Press ↵ Enter. This will copy the file to the specified directory. You can view the copied file by accessing the folder from File Explorer on your computer.

Copy the folder's data

Picture 13 of How to Copy Files in Command Prompt

Access the path to the folder. Type cdin a space, then enter the path to the folder and press ↵ Enter.

For example, if you want to copy all the files in the "Example" folder saved on your desktop, you would enter it C:UsershumpbDesktophere.

Picture 14 of How to Copy Files in Command Prompt

Enter command robocopy. Type robocopyin a space, but don't rush to press ↵ Enter.

Picture 15 of How to Copy Files in Command Prompt

Enter a folder name. Type the name of the folder you want to copy, then add a space. Again, don't rush to press ↵ Enter.

Similar to file names, spaces in folder names must be enclosed in quotation marks.

Picture 16 of How to Copy Files in Command Prompt

Enter the destination folder. Type the path to where you want to save the copied data.

If the root folder has many files, copying those files to another folder that already has a lot of data will make you confused because you cannot copy the original folder.

Picture 17 of How to Copy Files in Command Prompt

Press ↵ Enter. This will copy the original folder's data to another specified folder.

Update 19 June 2024
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile