How to Copy Files in Command Prompt

This wikiHow teaches you how to use Windows' Command Prompt program to copy a file or folder. Find out your file's location. You'll need the file's location—also known as a 'directory'—in order to tell Command Prompt where to look for the f...

Part 1 of 3:

Preparing to Copy

  1. Picture 1 of How to Copy Files in Command Prompt
    Find out your file's location. You'll need the file's location—also known as a "directory"—in order to tell Command Prompt where to look for the file.
    1. You can find the file's directory by going to the file's location in File Explorer and then clicking the URL bar near the top of the File Explorer window.
    2. Most files will be somewhere in the following directory: [drive letter]:Users[username] (for example, "C:UsersKyle"). This is the directory in which almost every user-created file on your computer is located.
    3. A file on your desktop for the above example would be in the "C:UsersKyleDesktop" directory, while a file in the Documents folder would be in the "C:UsersKyleDocuments" directory.
  2. Picture 2 of How to Copy Files in Command Prompt
    Know your file's name. If you want to copy your file, you'll need to know its name. Keep in mind that file names are case-sensitive in Command Prompt, so you'll need to include the proper capitalization.
  3. Picture 3 of How to Copy Files in Command Prompt
    Open Start
    Picture 4 of How to Copy Files in Command Prompt
    . Click the Windows logo in the bottom-left corner of the screen.
  4. Picture 5 of How to Copy Files in Command Prompt
    Type in command prompt. Doing so will search your computer for the Command Prompt program.
  5. Picture 6 of How to Copy Files in Command Prompt
    Click
    Picture 7 of How to Copy Files in Command Prompt
    Command Prompt. It's at the top of the Start window. Doing so will open the Command Prompt program.
    1. Keep in mind that if you're on a shared computer (e.g., a school or public PC), you may not be able to access the Command Prompt.
Part 2 of 3:

Copying Individual Files

  1. Picture 8 of How to Copy Files in Command Prompt
    Enter the "change directory" command. Type in cd followed by a space, but don't press Enter.
  2. Picture 9 of How to Copy Files in Command Prompt
    Type in your file's directory. Enter the directory in which the file that you want to copy is located.
  3. Picture 10 of How to Copy Files in Command Prompt
    Press Enter. Doing so will reset Command Prompt to look in the entered directory.
  4. Picture 11 of How to Copy Files in Command Prompt
    Enter the "copy" command. Type in copy followed by a space, but don't press Enter yet.
  5. Picture 12 of How to Copy Files in Command Prompt
    Enter your file's name. Type in your file's name followed by a space, making sure to include the file's extension (e.g., .txt) for a text file. Don't press Enter after doing so.
    1. If there are spaces in the file's name, you need to put quotation marks around them. For example, a file named "Pickles are Good.txt" would be Pickles" "are" "Good.txt in Command Prompt.
  6. Picture 13 of How to Copy Files in Command Prompt
    Enter a destination directory. Type in another directory (e.g., C:Users[you]Desktop into which you want to copy the file.
    1. If you don't do this, the file will be copied to your user directory (e.g., "C:Users[you]") by default.
  7. Picture 14 of How to Copy Files in Command Prompt
    Press Enter. Doing so will copy the file into your indicated directory. You can view the copied file by going to the directory in question in your computer's File Explorer.
Part 3 of 3:

Copying a Folder's Contents

  1. Picture 15 of How to Copy Files in Command Prompt
    Go to the folder's directory. Type in cd followed by a space, then type in the folder's directory and press Enter.
    1. For example, if you want to copy all of the files inside of a folder called "Example" that's on your desktop, you'd go to C:UsershumpbDesktop here.
  2. Picture 16 of How to Copy Files in Command Prompt
    Enter the robocopy command. Type in robocopy and then a space, but don't press Enter yet.
  3. Picture 17 of How to Copy Files in Command Prompt
    Enter a folder's name. Type in the name of the folder that you want to copy, then add a space. Again, don't press the Enter key just yet.
    1. As with file names, you'll need to use quotes around any spaces in the folder name.
  4. Picture 18 of How to Copy Files in Command Prompt
    Enter a destination. Type in a directory into which you want to copy the folder's files.
    1. If there are lots of files in the folder, this can get messy if you copy them into an unorganized folder since the folder itself won't be copied with the files.
  5. Picture 19 of How to Copy Files in Command Prompt
    Press Enter. Doing so will copy the contents of the folder into your destination folder.
« PREV POST
READ NEXT »