How to Copy & Paste Files Using Command Prompt

Techwalla may earn compensation through affiliate links in this story.
Image Credit: BananaStock/BananaStock/Getty Images

Although many people regard the command line as something to be relegated to the dustbin of computing history and forgotten, it is still a powerful tool for accomplishing any number of basic computer tasks. One task that is commonly done using a graphical user interface is the copying of files. In a GUI, this procedure takes two distinct steps--copying and pasting--on a command line, it can be done in a single step.


Finding the file to be copied

Step 1

Open a command prompt. On a Windows computer, press "Windows-R" to get the run prompt, and then type in "CMD.exe." On a Unix-based machine, open your terminal program.


Video of the Day

Step 2

Wait for the terminal to appear. On a Windows machine, type in the following to select the drive your files are located on: ":/" Replace with the appropriate letter corresponding to your drive. Skip this step for a Unix-based operating system.

Step 3

Type in the following: "cd /" Replace with the name of the folder that your target folder resides in. Replace with the target folder's name. There may be more than one parent folder; if so, add the them into the path as follows: "cd //"


Step 4

Make a note of the destination folder you wish to copy your files into. It should be something like this: "/"

Step 5

Enter the following command to copy your chosen file from the original folder to the new one:


In Windows: "copy <example.txt> :///"

In Unix: "cp <example.txt> ///

Replace the variables with the above-mentioned info, and make sure to include all of the spaces and slashes.


The Unix instructions apply to both Mac OS, Linux, and all other Unix based operating systems.

The Windows commands work on all versions of both MS-DOS and Windows.