Chat Zalo Chat Messenger Phone Number Đăng nhập
How to Change Directories in Command Prompt on Windows 10

How to Change Directories in Command Prompt on Windows 10

A Windows logo on a white background. Header.

One of the first things you’ll need to learn as you become familiar with the command prompt in Windows 10 is how to change directories in the operating system’s file system. There are a few ways to do this, so we’ll walk you through them.

First, type “cmd” in the Windows search bar to open the command prompt and then select “Command Prompt” from the search results.

Command prompt app in windows search

With the command prompt open, you

are ready to switch directories

.

Change directories by dragging and dropping

If the folder you want to open at the command prompt is on the desktop or is already open in File Explorer, you can quickly switch to that directory. Type cd followed by a space, drag and drop the folder into the window, and then press Enter.

The directory you changed to will be reflected on the command line.

Change directories within the command prompt

It is not always convenient to open File Explorer and drag and drop. That’s why it’s great that you can also type a command to change directories directly at the command prompt.

RELATED: 10 Useful Windows Commands You Should Know

Let’s say, for example, that you are in your user folder and there is a “Documents” directory in the following file path. You can type the following command at the command prompt to switch to that directory:

cd Documents

Note that this only works if you are in the immediate file structure. In our case, that would be (user folder) > Documents. In our current directory, we wouldn’t be able to use this method to jump to a nested directory two levels down.

So, let’s say we are currently in the user folder and want to go to the “How-To Geek” folder, which is nested in “Documents”. If we try to jump directly to “How-To Geek” without going to “Documents” first, we get the error shown in the image below.

""The

Let’s take things one directory at a time, for now. As we mentioned earlier, we are currently in our user folder. We type cd Documents in the command prompt to visit “Documents”.

"The

We are now in the "Documents" folder. To go down another level, we write cd in the command line followed by the name of that directory.

"The

Now, let’s say we’re back in our user folder and want to skip that extra step and jump two directories down. In our case, this would be our “How-To Geek” folder. We write

the following command: cd DocumentsHow-To Geek

This allows us to move two levels of directory with a single

command.

"The

If you ever go to the wrong directory and want to go back, type the following command:

cd..

This allows you to level up.

"The

A navigation suggestion

If you want to be a little more efficient with directory changes, type cd at the command line, followed by the first few letters of the directory you want. Then, press Tab to autocomplete the directory name.

Alternatively, you can write cd, followed by the first letter of the directory, and then press Tab repeatedly until the correct directory appears.

View Directory Contents

If you ever get lost and aren’t sure where to go next, you can view the contents of your current directory by typing dir on the command line

.

"The

This will give you a clue as to which directory to navigate to next.

Contact US