How to change directory in Command Prompt in Windows 10

One of the first things you will 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 several ways to do this, so we’ll walk you through them.

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

Click on "Command Prompt" in Windows 10 search results.

With the command prompt open, you are ready to change directories.

Change directory using drag-and-drop method

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

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

Change directory in command prompt

It is not always convenient to open File Explorer and drag and drop. This is why it is interesting that you can also type a command to change directory directly in the command prompt.

RELATED: 10 useful Windows commands you should know

Suppose, 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 in the command prompt to switch to this directory:

cd Documents

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

So let’s say we’re 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 straight to “How-To Geek” without going to “Documents” first, we get the error shown in the image below.

"The system cannot find the specified path" error message in command prompt.

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

The "CD Documents" command in the command prompt.

We are now in the “Documents” folder. To go down to another level, we type cd on the command line followed by the name of this directory.

The "cd How-To Geek" command in the command prompt.

Now let’s say we’re back in our user folder and want to skip that extra step and skip two directories down. In our case, it would be our “How-To Geek” folder. We type the following command:

cd DocumentsHow-To Geek

This allows us to move two directory levels with a single command.

The "cd Documents  Comment Geek" command in the command prompt.

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

CD.  . 

This allows you to move up a level.

The "CD.  . " command in the command prompt.

A Navigation Tip

If you want to be a bit more efficient with your directory changes, type cd on the command line, followed by the first letters of the desired directory. Then press Tab to automatically complete the directory name.

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

See the contents of the directory

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

The "real" command and the contents of a directory in the command prompt.

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

Comments are closed.