Skip to content

How to change directory in Command Prompt (cmd)?

  • by
  • 3 min read

Command Prompt is a command-based user interface of Windows, which is different from the graphical user interface as here you will have to enter a string of commands to perform functions that are otherwise a few clicks away in a GUI. In this article, we explain how you can change the directory in the Windows command prompt.

Change directory in Command Prompt (cmd)

Follow the steps given below to change the directory in the Windows command prompt.

Step 1: First, you will have to open the command prompt. Type cmd in the search box or press the Windows key + R and then type cmd in the Run window.Step 2: In the command prompt, type cd <space> directory path. For example, cd C:\Program Files\ will take you to this folder on the computer. Similarly, you can choose any other destination that you like.

Step 3: Once you are done with the syntax above, press Enter, and you will access the directory that you have mentioned above. Also read: How to find computer name via command prompt in Windows?

Points to remember

There are a few points that you should keep in mind before changing the directory in cmd.

  • Always give the space between the command cd and the directory path.
  • Remember, if you want to change the destination to some other drive, then you will have to include the command /D between the cd and the path. For example, if you are in C:\Users\HP and want to change the path to the D:\ drive then you will have to write cd /D D:\. If you skip the /D command in between, you won’t get an error, but you will remain in the same folder, which is C:\Users\HP.

  • If you are a frequent user of the command prompt, then the following command will come in handy. Use the pushd command to save the directory that you were working on. After that, use the popd command to go back to that saved directory. Look at the screenshot below to get an idea.

Also read: How to create an FTP connection on Windows?

Kumar Hemant

Kumar Hemant

Deputy Editor at Candid.Technology. Hemant writes at the intersection of tech and culture and has a keen interest in science, social issues and international relations. You can contact him here: