Tips & Tricks

The cd Command in CMD: How to Change Folders and Switch Drives in Windows

The cd command in CMD enables folder navigation by moving between directories or switching drives. Key methods include using "cd [folder name]" to enter directories, "cd.." to move back, "cd \" to return to the root, and typing a drive letter with a colon.

The cd Command in CMD: How to Change Folders and Switch Drives in Windows

Whether you want to change the attributes of a specific file, browse a particular folder, or do anything else in Command Prompt, you first have to navigate to that folder. Fortunately, moving through folders in Windows Command Prompt is easy once you know the cd command in CMD and a few other basic commands.

Open Command Prompt as an administrator

The first step is to open Command Prompt with admin rights. This matters because otherwise Windows may not let you change directories in some cases. To do it, search for Command Prompt in Windows Search, then right-click it and choose Run as administrator. If a UAC window pops up, click Yes.

How to navigate folders in Windows Command Prompt
Running Command Prompt as an administrator on Windows.

This opens a Command Prompt window with administrative privileges, giving you the access needed to carry out management tasks without restrictions. Be careful when using admin rights, though, because a mistake can cause more serious problems.

Commands for navigating folders in Command Prompt

To move back and forth between folders in Command Prompt, you need to get familiar with two main commands:

  • Change directory: cd
  • List directory contents: dir

The dir command gives you a list of the folders available to enter, while the cd command in CMD takes you to the folder you want. If you know the name of the folder you want to go to, type that name after "cd" to move there (for example, "cd downloads"). If you want to go back to the previous folder, add two dots next to the "cd" command, like this: "cd.."

Tip: You only need to list folders when you're not sure where to go. If you already know the folder name, there's no need to use the "dir" command.

How to use the cd command in CMD with the "dir" command

Let's take a closer look at how you can navigate folders by combining the cd command in CMD with the "dir" command, using an example.

Say you want to navigate from the starting point (C:\Windows\system32) to the Downloads folder (C:\Users\<username>\Downloads).

First, you need to get back to the C: drive. To do that, use the "cd.." command twice to move out of the System32 and Windows folders, which brings you back to the root directory.

How to navigate folders in Windows Command Prompt
Using the 'cd..' command twice to move back two folders in Windows Command Prompt.

Now, if you're not sure of the exact name of the first folder you need to go to, you can list the available folders to find the right one: type "dir" to display the list.

How to navigate folders in Windows Command Prompt
Using the 'dir' command in Windows Command Prompt to list the folders available on the C drive.

Once you know you need to go to the Users folder, type "cd Users" and you'll be taken to C:\Users. From there, you can continue to the next two folders with the cd command in CMD, like this:

cd <username> cd Downloads
How to navigate folders in Windows Command Prompt
Using the 'cd' command twice in Windows Command Prompt to reach the desired folder.

Note that your system won't have the ehtas folder shown above; that username is unique to the example system. You'll type your own username there.

2 commands for easier folder navigation in Command Prompt

Besides the commands covered so far, a couple of additional ones make navigating folders in Command Prompt easier:

1. You can use the cd command in CMD with the syntax "cd \" to go back to the root folder of the current drive. For example, if you're in the C:\Windows\System32\AppLocker folder and want to return straight to the main C: drive, type this command and press Enter.

How to navigate folders in Windows Command Prompt
Using the command to return to the root folder of the “C” drive in Windows Command Prompt.

2. Similarly, the cd command in CMD isn't enough to switch drives; from the root folder (or any other folder), type the drive letter followed by a colon, such as "S:".

How to navigate folders in Windows Command Prompt
Switching drives in Windows Command Prompt.

How to open Command Prompt in a specific folder from File Explorer

Opening a CMD window from File Explorer removes the need to hop between folders with a series of commands in Command Prompt.

Open File Explorer by clicking the folder icon on the taskbar. Navigate to the folder you want to access in Command Prompt. Type "cmd" in the address bar and press Enter. This opens Command Prompt in the current folder.

How to navigate folders in Windows Command Prompt
Using the 'cmd' command in the File Explorer address bar to open Command Prompt in that folder.

Using Command Prompt may not be simple at first, and it will certainly take a little time to get used to. Once you've mastered the cd command in CMD and the other navigation commands, though, you'll be able to move through the folders on your computer quickly and easily.

Share: Facebook X / Twitter Email Pinterest LinkedIn
Question and answer (0 comments)

Your name and comment are shown publicly; your email is not. See Privacy Policy.

Table of contents
  1. Open Command Prompt as an administrator
  2. Commands for navigating folders in Command Prompt
  3. How to use the cd command in CMD with the "dir" command
  4. 2 commands for easier folder navigation in Command Prompt
  5. How to open Command Prompt in a specific folder from File Explorer