PDF download Download Article
Copy files from one directory to another using CMD
PDF download Download Article

While you can easily copy files in File Explorer, sometimes you need to use Command Prompt to copy them instead. Navigating the file system with Windows Command Prompt (cmd) might seem daunting, but it's actually pretty easy once you get the hang of it. This wikiHow will teach you how to copy one or more files from one folder to another from the command line in Windows.

Copying Files in Command Prompt

  • Before you begin, open Command Prompt and use the cd command to change to the directory containing the file you want to copy.
  • To copy an individual file, type copy [filename.ext] [destination directory], replacing [filename.ext] with the file's name and extension, and [destination directory] with the directory you want to copy the file to.
  • To copy all the files in a folder, type robocopy [folder directory] [destination directory], where [folder directory] is the path to the folder you're copying from, while [destination directory] is the path to the folder you're copying to.
Section 1 of 2:

Copying Individual Files

PDF download Download Article
  1. Find 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.
    • You can find the file's directory by opening File Explorer to the file's location and then clicking the URL bar near the top of the window.
  2. 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.
    Advertisement
  3. Type in cd followed by the directory that you located in step 1, then press ↵ Enter.
    • You can simply copy the file directory from File Explorer by clicking on the path in the address bar at the top of the window and pressing Ctrl+C, then you can paste it into Command Prompt with Ctrl+V.
  4. Type copy followed by a space, but don't press ↵ Enter yet.[2]
  5. Type your file's name, followed by a space, and include the file's extension (e.g., .txt for a text file). Don't press ↵ Enter after doing so.[3]
    • If there are spaces in the file's name, you need to put quotation marks around the filename. For example, a file named Pickles are Good.txt would be "Pickles are Good.txt" in Command Prompt.
  6. Type in another directory (e.g., C:\Users\[you]\Desktop into which you want to copy the file.
    • If you don't do this, the file will be copied to your user directory (e.g., "C:\Users\[you]") by default.
  7. Doing so will copy the file to the directory you specified. You can view the copied file by going to the directory in question in your computer's File Explorer.
  8. Advertisement
Section 2 of 2:

Copying a Folder's Contents

PDF download Download Article
  1. You'll need the directory path to the folder you're copying from as well as the folder you're copying to. Make sure you get the full string by clicking the bar at the top of the File Explorer window when that folder is open.
  2. Type in robocopy and then a space, but don't press ↵ Enter yet.[5]
  3. Type the path of the folder you want to copy, then press Space. Again, don't press the ↵ Enter key just yet.
    • If there are spaces in the folder's name, make sure to put quotes around the entire directory string.
  4. Type the directory you want to copy the folder's files into.[6]
    • 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.
    • For example, your full command might look something like this: robocopy C:\Users\[username]\Documents\Folder1 C:\Users\[username]\Documents\Folder2.
  5. Doing so will copy the contents of the folder into your destination folder.
  6. Advertisement

Community Q&A

Search
Add New Question
  • Question
    Which command should I use to copy files?
    Community Answer
    Community Answer
    Copy "source path" "destination path". For example, you might copy "C:\Users\qclab\Desktop\Stuff.txt" "P:\IT\Confidential". The quotation marks are optional unless you have spaces in your folder or file names. To copy everything in a folder use *.* as the name and extension. For example, copy "C:\Users\qclab\Desktop\Stuff.txt" "P:\IT\Confidential".
  • Question
    Is it possible to move a PDF file from one folder to another and not have it overwrite another file with the same name by having a different date?
    Community Answer
    Community Answer
    You'll have to rename the PDF file prior to moving it, as two files with the same name can't reside in the same folder.
  • Question
    How can I copy all files from sub directories with a similar name to a different directory?
    Community Answer
    Community Answer
    After you do one, press the up key and then change the name, which shouldn't take up much time.
See more answers
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
Advertisement

Video

Tips

  • If you want to create a new destination folder for a set of copied files, enter the directory for the destination folder (including the destination folder itself) in conjunction with the "robocopy" command.[7]
  • You can copy all files in a directory by typing copy *[file type] (e.g., copy *.txt).
  • If you copy the Desktop folder's contents into a new folder, that new folder will be renamed to "Desktop".
Submit a Tip
All tip submissions are carefully reviewed before being published
Name
Please provide your name and last initial
Thanks for submitting a tip for review!
Advertisement

Warnings

  • Copying files and folders in Command Prompt can be dangerous if you don't know what you're doing. Never copy or manipulate any files or folders that you don't understand.
Advertisement

You Might Also Like

Advertisement

About This Article

Hannah Dillon
Written by:
wikiHow Technology Writer
This article was co-authored by wikiHow staff writer, Hannah Dillon. Hannah Dillon is a Technology Writer and Editor at wikiHow. She graduated with a B.A. in Journalism from North Dakota State University in 2013 and has since worked in the video game industry as well as a few newspapers. From a young age Hannah has cultivated a love for writing and technology, and hopes to use these passions in tandem to help others in the articles she writes for wikiHow. This article has been viewed 2,454,905 times.
How helpful is this?
Co-authors: 27
Updated: May 6, 2026
Views: 2,454,905
Categories: Command Prompt
Article SummaryX

1. Type "cd" followed by a space in command prompt, but don't press "enter" yet.
2. Type the name of the directory your filed is located in.
3. Press "enter."
4. Type "copy" followed by a space, but don't press "enter."
5. Type your file's name followed by a space, but don't press "enter."
6. Type in the name of the directory you want to copy the file to.
7. Press "enter" to copy the file.

Did this summary help you?

Thanks to all authors for creating a page that has been read 2,454,905 times.

Reader Success Stories

  • Aditya Ojha

    Aditya Ojha

    Nov 2, 2017

    "This is one of the great ways of gaining knowledge whatever one wants to know. So, I really want to thank all the..." more
Share your story

Is this article up to date?

Advertisement