Command Prompt - How to Use Basic Commands

After we have shared how to open and customize Command Prompt, it is time to see how to use it to perform basic operations. This article will show how to execute commands like changing the working directory, viewing content of a directory, creating and renaming folders, copying, deleting files and folders, and how to launch any application from Command Prompt. Also, it will show how to get help when using the tool.

How to Navigate Between Folders

The first command from the list is CD (Change Directory). This command enables you to change the current directory (or folder).

The command CD\ takes you to the top of the directory tree.
Let's see how it works. After you open the Command Prompt, type cd\ and press Enter. You will see that it takes you to the top of the directory tree (in this case to the 'C:' drive).

NOTE: Command Prompt is not case sensitive, meaning that commands can be typed with capital letters, lowercase or a combination of them(so cd, CD or Cd will all work in the same way).

Command Prompt

Now you are working on the 'C:' drive. If you need to go to a specific folder from this drive just type CD DIRECTORYNAME. The subdirectory names are separated by \. For example when you need to access the System32 folder that is located on 'C:\Windows' just type cd windows\system32\, as shown below, and then press Enter.

Command Prompt

When you need to go to one folder up, use the cd.. command. Let's assume that you want to go back to the Windows folder. Type cd.. and press Enter. You will notice that your current directory has changed to 'C:\Windows'.

Command Prompt

How to Access a Certain Drive

To access another drive just type the drive letter followed by ':'. For example, we wanted to change the drive from 'C:' to 'D:'. We have typed d: and then pressed Enter.

Command Prompt

To change the drive and the directory at the same time, use the cd command followed by the /d switch. The parameter is used to change the current drive to a specific folder from other partition. For example, now you are on the 'D:' drive and you want to go back to the 'C:' drive directly to the Windows folder. Type cd/d C:\Windows and press Enter, as you can see in the following image.

Command PromptNote: By typing the drive letter you automatically move to your most recent location in that drive. For example if you are on 'd:' drive and type cd c:\windows nothing happen. But, if you type 'c:' then the working will change to c:\windows (assuming that it was the last directory you worked with on c: drive).

How to View the Content of a Folder

You can view the content of a folder by using a simple command called DIR. To test, we've created on the 'd:' drive a folder named 7tutorials with several files and subfolders.

Command Prompt

Last time the working directory was 'c:\Windows'. We will go to the folder mentioned above by using the command cd/d d:\7tutorials. To view the content of the folder we will type DIR and press Enter. A list of the files and folders contained by it is displayed, together with some details about these files and folders (size, the date and time of the last modification).

Command Prompt

How to Create a New Folder

You can make a new directory using the MKDIR (Make Directory) command. The syntax of this command is MKDIR directory name.

Let's say we need to create a new folder called 7tutorials_v1 that will be placed in the 'd:\7tutorials' folder. We will type mkdir 7tutorials_v1 and then we press Enter, as shown below.

Command Prompt

To test if it worked, we will use again the dir command. The newly created folder appears in the list.

Command PromptNote: Don't forget that all these commands depend on the current location in the Command Prompt. So if you are at 'C:' and type MKDIR test, a new folder will be created in the 'C:' drive.

Another way to create a directory, that doesn't involve being on the desired folder, is to type the complete the path of the folder. For example, you are working on the 'D:' drive and you want to create a new folder on 'C:' drive called other_stuff. Just type mkdir c:\other_stuff and then press Enter.

Command Prompt

When you need to create a folder with subfolders at the same time you can use the MKDIR foldername\subfolder command . For instance, if we type mkdir 7tutorials_tests\beta\test1 three folders will be created: 7tutorials_tests, beta, test1, in a tree-like structure.

Command Prompt

How to Rename Files and Folders

To rename files and folders you need to use the REN (Rename) command.

For folders just type ren foldername newname. For example if we want to rename the 7tutorials_v1 folder to 7tutorials_final we type ren 7tutorials_v1 7tutorials_final and then press Enter.

Command Prompt

To rename a file, use the same command, like this: ren filename.extension newname.extension. For example, to rename the 7tutorials_picture.jpg file to picture1.jpg we have to use the ren 7tutorials_picture.jpg picture1.jpg command.

Command Prompt


About the Author: Maximilian
I’m an information technology enthusiast that thinks and can always argument the opinion that is the perfect place for every user to learn how to master the “new and improved” Windows 7. As technology evolves it’s obvious that people need it and of course learn how to use it. Happy to help!