How to Copy Files in Command Prompt (with Image)

Table of contents:

How to Copy Files in Command Prompt (with Image)
How to Copy Files in Command Prompt (with Image)

Video: How to Copy Files in Command Prompt (with Image)

Video: How to Copy Files in Command Prompt (with Image)
Video: Dell XPS 13-9343 (P54G001) Keyboard How-To Video Tutorial 2024, December
Anonim

This wikiHow teaches you how to use the Command Prompt program in Windows to copy files or folders.

Step

Part 1 of 3: Preparing for Copy

Copy Files in Command Prompt Step 1
Copy Files in Command Prompt Step 1

Step 1. Find out the location of the file you want to copy

You'll need the location of the file (known as a "directory") in order to tell the Command Prompt to find the file you want.

  • You can find the file's directory by opening the file's location in File Explorer and clicking the URL bar at the top of the window.
  • Most files will be stored in the following directory: [disk name]:\Users\[username] (for example, "C:\Users\Kyle"). This is the directory that holds most of the files created by the user.
  • In the example above, the files stored on the desktop are in the "C:\Users\Kyle\Desktop" directory, while the files stored in the Documents folder are in the "C:\Users\Kyle\Documents" directory.
Copy Files in Command Prompt Step 2
Copy Files in Command Prompt Step 2

Step 2. Know the file name

If you want to copy a file, you need to know the name of the file in question. Keep in mind that the case of the name matters when you use the Command Prompt so you need to capitalize it properly.

Copy Files in Command Prompt Step 3
Copy Files in Command Prompt Step 3

Step 3. Open the “Start” menu

Windowsstart
Windowsstart

Click the Windows logo in the lower-left corner of the screen.

Copy Files in Command Prompt Step 4
Copy Files in Command Prompt Step 4

Step 4. Type in command prompt

After that, the computer will search for the Command Prompt program.

Copy Files in Command Prompt Step 5
Copy Files in Command Prompt Step 5

Step 5. Click

Windowscmd1
Windowscmd1

"Command Prompt".

It's at the top of the “Start” window. After that, the Command Prompt program will be opened.

Keep in mind that if you use a shared computer (eg a school or public computer), you may not be able to access the Command Prompt program

Part 2 of 3: Copying Files Separately

Copy Files in Command Prompt Step 6
Copy Files in Command Prompt Step 6

Step 1. Enter the command "change directory"

Type cd followed by a space, but don't press Enter.

Copy Files in Command Prompt Step 7
Copy Files in Command Prompt Step 7

Step 2. Type in the file directory

Enter the directory to which you want to copy files.

Copy Files in Command Prompt Step 8
Copy Files in Command Prompt Step 8

Step 3. Press Enter key

After that, the Command Prompt will reset to check the directory you entered.

Copy Files in Command Prompt Step 9
Copy Files in Command Prompt Step 9

Step 4. Enter the "copy" command

Type in copy followed by a space, without directly pressing Enter.

Copy Files in Command Prompt Step 10
Copy Files in Command Prompt Step 10

Step 5. Enter a file name

Type in a file name followed by a space, and make sure the file extension is included (eg.txt for text files). Don't press Enter immediately afterward.

If there is a space in the file name, you need to enclose it in quotation marks. For example, for a file called "Pickles are Good.txt", you would type Pickles" "are" "Good.txt" in the Command Prompt window

Copy Files in Command Prompt Step 11
Copy Files in Command Prompt Step 11

Step 6. Enter the destination directory

Type in another directory (eg C:\Users\[you]\Desktop where you want to copy files to.

If you don't add a directory, the files will be copied to your user directory (eg "C:\Users\[you]") automatically

Copy Files in Command Prompt Step 12
Copy Files in Command Prompt Step 12

Step 7. Press Enter key

After that, the file will be copied to the specified directory. You can view the copied files by visiting the directory in the File Explorer program.

Part 3 of 3: Copying Folder Contents

Copy Files in Command Prompt Step 13
Copy Files in Command Prompt Step 13

Step 1. Visit the folder directory

Type cd followed by a space, then type the directory of the respective folder and press Enter.

For example, if you want to copy all the files in the " Example " folder on your desktop, type C:\Users\humpb\Desktop into the Command Prompt window

Copy Files in Command Prompt Step 14
Copy Files in Command Prompt Step 14

Step 2. Enter the robocopy command

Type robocopy and add a space, without directly pressing Enter.

Copy Files in Command Prompt Step 15
Copy Files in Command Prompt Step 15

Step 3. Enter the folder name

Type in the name of the folder you want to copy and add a space after it. Again, don't press Enter immediately afterward.

As with file names, you need to use quotation marks to enclose spaces in folder names

Copy Files in Command Prompt Step 16
Copy Files in Command Prompt Step 16

Step 4. Enter the destination directory

Type in the directory you want to copy the contents of the folder to.

If there are a lot of files in the source folder, the destination folder will look messy because the source folder itself won't be copied along with the files

Copy Files in Command Prompt Step 17
Copy Files in Command Prompt Step 17

Step 5. Press Enter key

After that, the contents of the folder will be copied to the destination folder.

Tips

  • You can copy all files in the directory by typing copy *[file type] (eg copy *.txt).
  • If you want to create a new destination folder for the copied files, enter the directory for the new destination folder (including the destination folder itself) after the "robocopy" command.
  • If you copy the contents of an existing folder on the Desktop to a new folder, the folder will be named as "Desktop".

Recommended: