Quick Links

Key Takeaways

  • To change directories in Command Prompt on Windows 10, you can use the drag-and-drop method by typing "cd," dragging the folder into the window, and pressing Enter.
  • Alternatively, you can type the "cd" command followed by the directory name to change directories directly within Command Prompt.
  • Typing "cd .." allows you to move up a level if you navigate to the wrong directory, and using "dir" shows you the contents of your current directory.

How to Open the Command Prompt on Windows

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

This article discusses Command Prompt specifically, but the same behaviors hold for PowerShell, too.

First, type "cmd" in the Windows Search bar to open Command Prompt, and then select "Command Prompt" from the search results.

Search "Command Prompt," then click the result or click "Open."

With Command Prompt opened, you're ready to change directories.

Change Directories Using the Drag-and-Drop Method

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

Drag your folder on to the Command Prompt to grab the folder's path.

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

Change Directories Within Command Prompt

It's not always convenient to open File Explorer and drag and drop. That's why it's cool that you can also type a command to change directories right in Command Prompt.

Say, for example, you're in your user folder, and there's a "Documents" directory in the next file path. You can type the following command in Command Prompt to switch to that directory:

cd DocumentsNote that this only works if you're 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 directory nested 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 first going to "Documents," we get the error shown in the image below.

The How-To Geek folder cannot be found.

Let's take things one directory at a time, for now. As we mentioned previously, we're currently in our user folder. We type cd Documents in Command Prompt to visit "Documents."

Type "cd Documents" to change the directory to the Documents folder.

We're now in the "Documents" folder. To move down another level, we type cd on the command line followed by the name of that directory.

Command Prompt is now in the How-To Geek folder.

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 type the following command:

cd Documents\How-To Geek

This allows us to move two directory levels with one command.

Enter the How-To Geek subfolder in one command.

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

cd ..

This allows you to move up a level.

Using cd .. to go back one directory.

If you want to go back two directories, you can use multiple instances of .. together. Let's use the example where we're in C:\Users\Equinox\Documents\How-To Geek. Running cd .. will change the directory to "C:\Users\Equinox\Documents." But what if we wanted to go all the way back to our user folder? Just enter cd ..\.. instead. If you wanted to go back three directories you'd use ..\..\.. and so forth.

You can go back more than one directory in a single line.

Change Hard Drives in Command Prompt

So, you can now move around within a drive proficiently, but what if your PC has multiple drives? This only requires a minor tweak on the cd command that you're already familiar with. Enter cd /D (LETTER):, where (LETTER) is the letter of the drive you want to switch to. Let's use the J:\ drive as an example, though it could be anything depending on how your system is set up.

cd /D J:

Using cd to change from the C:\ drive to the J:\ drive.

A Navigation Tip

If you want to be a bit more efficient with your directory changes, type cd on the command line, then press Tab. Every time you press table it'll cycle through the folders in your current directory in alphabetical order (special characters first, then numbers, then letters).

Recycle Bin is the first item in this case.

If you want to to narrow things down a bit, you can type cd, followed by the first letter of the directory, and then press Tab multiple times until the correct directory appears. If you type the first few letters of the directory you want and those letters are unique to the folder you want, you can press Tab to autocomplete to directory name.

Let's pretend you have the directories ABCDEFHIJK, ROC1, ROC2, and ROC3 in a folder. If you typed cd A and pressed Tab, it would automatically fill cd ABCDEFHIJK. If you typed cd R, cd RO, or cd ROC it would cycle between ROC1, ROC2, and ROC3 since there are three directories that match R, RO, and ROC.

Enter a letter and press Tab to cycle between directories that start with that letter.

See Directory Contents

If you're ever lost and not sure where to go next, you can view the contents of your current directory by typing dir on the command line.

Enter "dir" to see the contents of your current directory.

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