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.
First, type “cmd” in the Windows Search bar to open Command Prompt, and then select “Command Prompt” from the search results.
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.
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.
RELATED: 10 Useful Windows Commands You Should Know
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 Documents
Note 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.
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.”
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.
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 DocumentsHow-To Geek
This allows us to move two directory levels with 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.
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 few letters of the directory you want. Then, press Tab to autocomplete the directory name.
Alternatively, you can type cd
, followed by the first letter of the directory, and then press Tab multiple times until the correct directory appears.
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.
This will give you a hint as to which directory to navigate to next.