cd Command Basics

1. How to change the directory (folder) in Command Prompt (CMD)

The first command from the list is cd (Change Directory). This command enables you to change the current directory or, in other words, to navigate to another folder from your PC. For instance, the command cd takes you to the top of the directory tree. To see how it works, after you open the Command Prompt, type cd and press Enter on your keyboard. You should see how the cd command takes you to the top of the directory tree. In this case, to the “C:” drive.

Note that the Command Prompt is not case sensitive, meaning that you can type commands using capital letters, lowercase or any combination of them. The commands CD, cd or Cd, all work the same way. Going back to the CD command, now you are working on the root of the “C:” drive. If you need to go to a specific folder from this drive run the command CD Folder The subfolders must be separated by a backslash character \ . For instance, when you need to access the System32 folder located in “C:\Windows,” type cd windows\system32 as shown below, and then press Enter on your keyboard.

When you need to go 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 on your keyboard.

The effect is that your current directory changes to C:\Windows.

2. How to change the drive in Command Prompt (CMD)

To access another drive, type the drive’s letter, followed by :. For instance, if you wanted to change the drive from C: to D:, you should type d: and then press Enter on your keyboard.

To change the drive and the directory at the same time, use the cd command, followed by the /d switch. The /d parameter is used to change the current drive to a specific folder from another disk volume. For instance, if you are now on the D: drive and you want to go back to the Windows folder from the C: drive, you should type cd /d C:\Windows and press Enter  on your keyboard, like in the following screenshot.

NOTE: By typing only the drive letter you automatically move to your most recent location on that drive. For instance, if you are on D: drive and type cd c:\windows nothing seems to happen. However, if you type c: then the working folder changes to c:\windows assuming that it was the last folder you worked with on your C: drive.

Leave a comment