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.
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.
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”.
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.
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.
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.
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.
This will give you a clue as to which directory to navigate to next.
Comments are closed.