Copy Files in Windows using Command prompt – How to

When Graphical user Interface (GUI) was not developed, people resorted to using command line to use the computer, though traditional, it is one of the most powerful tool to be used.

During the times, they had to remember the commands and type in, every time, even to do the most basic task.  Even if you have to invoke a simple text editor on your computer still you would need to remember the name of the executable file of that editor so that its name could be written and executed on the command prompt. Althought we have a very sophisticated GUI for our day to day operation, having knowledge of the CLI (command line interface) can sometimes say a day for you.

Say, for example, you computer crashed and you are welcome with a Command line interface, after reading the post you could do a few basic task with it.

We are exposing you today, to do a very basic task using the CLI, i.e. Copying Files

We know that we can simply right click on any file, select copy, and then paste it by the same method to some other location.
We are going tell you how to do it from the command prompt. Before we start we should understand how the file paths are defined in the command prompt.

Here is a tutorial  Copy Files in Windows using Command prompt

File Path

Example : C:\dnet\abc.doc 

Given above is an example of file path in which the file named abc.doc, is saved on the C Drive under a folder named ‘dnet’. This is how we name the files and their locations in command line. The drive letter has to have a Colon (:) and folders are separated by a backslash (\).

Copy Command

Syntax: COPY<space><from location\file name.extension><space><to location\file name.extension>

COPY is the name of the command which we need to use.

From location is the location where the file resides.

To Location is the location where you wish to copy it.

For example if you have to move the file abc.doc from ‘dnet’ to ‘new’ on the C Drive then you need to write the following command.

COPY C:\dnet\abc.doc C:\new\abc.doc

This will copy the file from one folder to another. Please note that using the full path for a file is not always necessary. This is required if you are currently not in that directory. If you already are in the C:\dnet directory then you can simply write the command as

COPY abc.doc C:\new\abc.doc

Again please note that full path for the destination is also always not required. If you have to copy the file to same location(with a different name) then you do not need to mention the full path. In the example given below you can copy the file abc.doc with the name abcnew.doc in the same folder.

COPY abc.doc abcnew.doc

 

Isn’t that simple?

It does take some time to get used to it, but it is fun

We will be posted more tutorial, to use the command line, in the future, so stay tuned.

Dhawal D