Copy files and folders
The Copy
command allows you to copy files from one location to another. To use
this command you have to type “copy location\filename.extension
newlocation\newname.extension”.
For example, let's use this command to copy the Picture1.jpg file from the Digital_Citizen folder located on the “D:” drive to the “D:\Digital_Citizen\Digital_Citizen_Tests\ folder. To make things more interesting we want the file to be named Testing_Picture1.gif. We will write the command “copy D:\Digital_Citizen\picture1.jpg D:\Digital_Citizen\Digital_Citizen_Tests\testing_picture1.gif” followed by Enter. You will receive a confirmation of the operation, as you can see below.

If you are copying within the same directory you don't have to put the path in command. As an example, we will copy Digital_Citizen_Notes.txt from “D:\Digital_Citizen” in the same folder, only with a different extension: let's say Digital_Citizen_Notes.doc. To do that, we have to run the command “copy Digital_Citizen_Notes.txt Digital_Citizen_Notes.doc”.

To copy a folder and its content from a location to another, use the XCOPY command followed by the “/s /i” operators. Let's assume that we need to copy a folder from “D:\Digital_Citizen” to “C:\Backup_Digital_Citizen”. To do that, we’ll have to run the command “xcopy /s /i d:\Digital_Citizen c:\Backup_Digital_Citizen”. The “/s” parameter will ensure that all the directories and subdirectories will be copied, except the ones that are empty. The '/i' parameter will create a new directory if the destination folder doesn't exist and will copy all the files.

NOTE: To also delete hidden files from the folder, you must add the “/h” parameter. Also note that the DEL command doesn’t work for deleting folders - for that, you’ll have to use the RD command of which we’ll talk in a bit.

If you need to delete a single file, use the DEL command followed by that file’s name. For instance, to delete the file Digital_Citizen_Notes.txt from “D:\Digital_Citizen”, we should run the command “del Digital_Citizen_Notes.txt”.

Here is a list of useful DEL combinations that are worth mentioning:



If a certain command interests you, type help followed by the name of that command. Another way to do the same thing is to type the command’s name followed by the “/?” parameter. To test it, use “help cd” or “cd/?” to display information about the cd command. In the picture below you can see the result.

The Command Prompt remains a very powerful tool for any computer user who is willing to get his hands dirty and learn new things. We hope this article was useful in helping you learn the basics about running commands in the Command Prompt. If you have any questions about it, don't hesitate to leave us a comment below.
For example, let's use this command to copy the Picture1.jpg file from the Digital_Citizen folder located on the “D:” drive to the “D:\Digital_Citizen\Digital_Citizen_Tests\ folder. To make things more interesting we want the file to be named Testing_Picture1.gif. We will write the command “copy D:\Digital_Citizen\picture1.jpg D:\Digital_Citizen\Digital_Citizen_Tests\testing_picture1.gif” followed by Enter. You will receive a confirmation of the operation, as you can see below.

If you are copying within the same directory you don't have to put the path in command. As an example, we will copy Digital_Citizen_Notes.txt from “D:\Digital_Citizen” in the same folder, only with a different extension: let's say Digital_Citizen_Notes.doc. To do that, we have to run the command “copy Digital_Citizen_Notes.txt Digital_Citizen_Notes.doc”.

To copy a folder and its content from a location to another, use the XCOPY command followed by the “/s /i” operators. Let's assume that we need to copy a folder from “D:\Digital_Citizen” to “C:\Backup_Digital_Citizen”. To do that, we’ll have to run the command “xcopy /s /i d:\Digital_Citizen c:\Backup_Digital_Citizen”. The “/s” parameter will ensure that all the directories and subdirectories will be copied, except the ones that are empty. The '/i' parameter will create a new directory if the destination folder doesn't exist and will copy all the files.

Delete files and folders
The DEL (Delete) is used to delete files from the folders you've created. To delete all the files from a folder you have to run the command “del folder”. For instance, from the directory Digital_Citizen found on the “D:” drive, we will delete all the files from the Digital_Citizen_Tests folder, by typing the command “del Digital_Citizen_Tests”. You need to confirm the delete process by typing the letter “y” and then press Enter.NOTE: To also delete hidden files from the folder, you must add the “/h” parameter. Also note that the DEL command doesn’t work for deleting folders - for that, you’ll have to use the RD command of which we’ll talk in a bit.

If you need to delete a single file, use the DEL command followed by that file’s name. For instance, to delete the file Digital_Citizen_Notes.txt from “D:\Digital_Citizen”, we should run the command “del Digital_Citizen_Notes.txt”.

Here is a list of useful DEL combinations that are worth mentioning:
- DEL *.DOC - delete all files with the DOC extension (you can use any file extension necessary, DOC is just an example);
- DEL Test*.* - delete all files beginning with Test;
- DEL *.* - delete ALL files from the current folder.

Launch an application from the Command Prompt
To run a program from the Command Prompt, you need only to navigate to the folder that contains the executable and type the program’s name. For example, if you want to launch Paint using Command Prompt, go to “C:\Windows\System32” and you will find the executable called mspaint.exe. Let's see how this operation is done, if you were in “D:\Digital_Citizen”. First off all, change the working directory to the application's folder by typing “cd /d c:\windows\System32\”. Then write mspaint.exe or simply mspaint and press Enter. Both commands can be seen in the screenshot below.
How to get help in Command Prompt
To access help in Command Prompt you have to type the help command and then press Enter. A list with all available commands will be displayed, as you can see below.
If a certain command interests you, type help followed by the name of that command. Another way to do the same thing is to type the command’s name followed by the “/?” parameter. To test it, use “help cd” or “cd/?” to display information about the cd command. In the picture below you can see the result.

Conclusion
The Command Prompt remains a very powerful tool for any computer user who is willing to get his hands dirty and learn new things. We hope this article was useful in helping you learn the basics about running commands in the Command Prompt. If you have any questions about it, don't hesitate to leave us a comment below.
Comments
Post a Comment