How to Change Directory in Command Prompt

Photo of author

By Victor Ashiedu

Published

This guide covers 5 options to change the directory in Command Prompt.

Option 1: Change to Root Directory

To change directory in Command Prompt to the root directory, enter the command below and press enter.

cd\

In this example, my Command Prompt is in the path “C:\Users\Victo”. To change to the root of C:. I will enter cd\ command and press enter on my keyboard. See the second image below – the directory is now in the root of C.

How to Change Directory in Command Prompt - Change to Root Directory
How to Change Directory in Command Prompt - Change to Root Directory

Option 2: Change Directory One Step from the Current Directory

You can also change directory, one directory behind the current directory. To do this, enter this command and press enter.

cd..

or

cd ..
The first command has no space between “cd” and the 2 periods “..”. Then second command does not. They both accomplish the same result.

Here is an example. My current Command Prompt is on “C:\Users\Victo”. However, I want to change it to “C:\Users” – here are the screenshots…

Option 3: Change Directory to Another Drive

If you are currently in a drive and want to change to another drive, enter the drive name, followed by a colon and the /d switch. Then, press enter. For example to change from drive C to E, enter the command below and press enter.

e: /d
e is the drive. It is NOT case-sensitive – can be lower or upper case. If you do not include the /d switch, command prompt will return to the current drive. To display the new drive, enter the drive letter, followed by a colon.

Option 4: Change Directory to a Full Path

You can also change directory in Command Prompt to a specified path. In this section, I will show you how to cd to a path on the same drive and on a different drive.

To change to a path on the same drive, enter cd followed by the full path you want to cd to – better to enclose the path in a double-quote (“”). In this example, I want to change to “C:\ESD”, I will enter this command and press enter…

cd "C:\ESD"

Command Prompt will change to the specified directory…

However, to change to a directory in a different drive, enter cd, followed by the full path. Then, run a second command – the new directory drive letter, followed by colon (:).

In the next example, I want to change from “C:\ESD” (current directory) to “E:\Archives” – a directory in another drive. I will use the following commands.

cd "E:\Archives"
e:

Here is the result of the commands in CMD…

Option 5: Change to a Directory in the Current Directory

There is a final option to change directory in Command Prompt – you can change to a directory in the current directory. To demonstrate this, I will first list all directories in the current directory with the dir command.

In this example, my CMD is in the path, “C:\G-Drive-P”. To list all directories in “G-Drive-P”, I will enter the command below and press enter.

dir

The “G-Drive-P” has 3 directories – “Reports”, “Operations Tools” and “Work Tools”.

To change to “Work Tools” directory, I will use the command below…

cd "Work Tools"

Command Prompt will change to the new directory.

Conclusion

You can use the options in this Itechguide to Change Directory in Command Prompt!

I hope you found this Itechguide helpful. If you found it helpful, click on “Yes” beside the “Was this page helpful” question below.

You may also express your thoughts and opinions by using the “Leave a Comment” form at the bottom of this page.

Finally, for more Windows Command Prompt Itechguides, visit our Windows Command Prompt page.

About the Author

Photo of author

Victor Ashiedu

Victor is the founder of InfoPress Media, publishers of Ilifeguides and Itechguides. With 20+ years of experience in IT infrastructure, his expertise spans Windows, Linux, and DevOps. Explore his contributions on Itechguides.com for insightful how-to guides and product reviews.

Related Articles

Get in Touch

We're committed to writing accurate content that informs and educates. To learn more, read our Content Writing Policy, Content Review Policy, Anti-plagiarism Policy, and About Us.

However, if this content does not meet your expectations, kindly reach out to us through one of the following means:

  1. Respond to "Was this page helpful?" above
  2. Leave a comment with the "Leave a Comment" form below
  3. Email us at [email protected] or via the Contact Us page.

Leave a comment

Send this to a friend