How to Change Directories in Command Prompt? - GeeksforGeeks (2025)

When working with the Windows Command Prompt, one of the most essential skills is knowing how to change directories in the Command Prompt. The ability to navigate folders in Command Prompt allows you to move between different directories, making it easier to manage files and execute commands in the right location.

This article will teach you how to use the cd command in Windows to efficiently switch directories and get your work done faster.

Table of Content

  • What are Directories?
    • Different Levels of Directories
  • How to Change Directories in CMD at Different Levels?
    • Level 1: Change Directories in the Root Level
    • Level 2: Change Directories in the Parent Level
    • Level 3: Change Directories to Subdirectories Level
    • Level 4: Change Directories in Nested Subdirectories Level
    • Level 5: Change Directories to Leaf Level
  • How to Change Directories in Command Prompt to Different Folders?
    • Method 1: Change Directories in Command Prompt using Drag and Drop
    • Method 2: Change Directories in Command Prompt using Commands
      • 1. Absolute Paths
      • 2. Relative Paths
      • 3. Drive Letters
      • 4. Environment Variables
      • 5. Tab Auto-Completion
      • 6. Previous Directory (`cd ..`)
      • 7. Using Wildcards
      • 8. Using the “dir” command
  • How Do I Navigate to a Specific Folder in Command Prompt?
  • How to Change Directories in Command Prompt – FAQs

By mastering these commands, you’ll be able to switch between folders, move between directories, and manage your files more effectively using Windows CMD.

How to Change Directories in Command Prompt? - GeeksforGeeks (1)

What are Directories?

Before diving into the specifics, let’s understand what are Directories, Different Operations on Directories, and how to change directories at different levels.

Directories are nothing but a File System on OS that contains information needed to access files. It’s like folders on your computer where you can organize and store files. They form a hierarchical structure, which means they have different levels, similar to a Tree Data Structure.

Different Levels of Directories

  • Roots Directory
  • Parent Directory
  • Subdirectory
  • Nested Subdirectory
  • Leaf Directory

How to Change Directories in CMD at Different Levels?

Before moving ahead with Changing Directories to Windows Folders, we have to understand Directory Changing to Different Levels. Let us discuss all the methods for Changing Directories in CMD at different levels:

Level 1: Change Directories in the Root Level

Open Command Prompt. To change to a directory in the root directory (Like “C:\” on Windows), you can use the `cd` command followed by the directory name. For example:

How to Change Directories in Command Prompt? - GeeksforGeeks (2)

Changing Directories in the Root Directory

Level 2: Change Directories in the Parent Level

Open Command Prompt. To move to a directory within the parent directory (like going from “Documents” to “Users”), simply use the `cd` command followed by `..` to go up one level, and then the name of the parent directory. For example:

How to Change Directories in Command Prompt? - GeeksforGeeks (3)

Changing Directories in the Parent Directory

Level 3: Change Directories to Subdirectories Level

Open CMD or Command Prompt. To enter a subdirectory within your current directory (like going from “Documents” to “Photos”), use the `cd` command followed by the name of the subdirectory. For example:

Level 4: Change Directories in Nested Subdirectories Level

Open CMD. To navigate to a deeply nested subdirectory (like going from “Documents” to “Work > Projects”), use the `cd` command with each subdirectory name, separated by a backslash (\). For example:

How to Change Directories in Command Prompt? - GeeksforGeeks (5)

Changing Directories in Nested Subdirectories

Level 5: Change Directories to Leaf Level

Open Command Prompt. If you want to enter a directory that doesn’t contain any subdirectories (like going to a folder with just files), use the `cd` command followed by the leaf directory’s name. For example:

How to Change Directories in Command Prompt? - GeeksforGeeks (6)

Changing Directories to Leaf Directories

Note: Remember, you can always type `cd ..` to go up one level and explore different directories easily.

How to Change Directories in Command Prompt to Different Folders?

Now, after discussing Directory Change in Different Levels, we will discuss all the possible methods that are required to Change Directories to Folders in the Windows Command Line Tool.

Method 1: Change Directories in Command Prompt using Drag and Drop

For those who prefer a graphical approach, changing directories using drag and drop is simple. You can open File Explorer, locate the desired directory, and drag it to the Command Prompt window. This action automatically populates the Command Line with the directory path.

How to Change Directories in Command Prompt? - GeeksforGeeks (7)

Change Directories Using Drag and Drop

Method 2: Change Directories in Command Prompt using Commands

Changing directories using commands may seem tricky at first, but it’s essential to get the hang of it in Command Prompt. Here are some easy methods to do it:

1. Absolute Paths

This is like using a full address to find a place. In Command Prompt, you can use the full path to a folder to get there directly. This will take you straight to your “Documents” folder. For instance:

How to Change Directories in Command Prompt? - GeeksforGeeks (8)

2. Relative Paths

Think of this as giving directions from where you are. You can use `..` to move up one level and the folder name to go into a subfolder. This will take you up one level from where you are right now. For example:

3. Drive Letters

Imagine switching between different drives as changing streets. To switch to a different drive, just type its letter and a colon. This will take you to the D: drive. For example:

How to Change Directories in Command Prompt? - GeeksforGeeks (10)

using Drive Paths

4. Environment Variables

These are like shortcuts to important places. You can use names like `%USERPROFILE%` to go to common folders without typing the whole path. This will take you to your user profile folder. For example:

How to Change Directories in Command Prompt? - GeeksforGeeks (11)

using Environment Variable

5. Tab Auto-Completion

Think of this as your Command Prompt assistant. When you start typing a folder name and press Tab, Command Prompt will try to finish it for you. If there’s more than one option, it will show you a list.

6. Previous Directory (`cd ..`)

This is like having a “go back” button. If you want to return to the folder you were in before, just type `cd ..`. It’s like a quick way to backtrack.

7. Using Wildcards

Wildcards are like search filters. You can use `*` to find folders based on patterns. This will take you to a folder with a name starting with “sep”. For example:

How to Change Directories in Command Prompt? - GeeksforGeeks (12)

cd C:\Users\GFG0338\Desktop\mystuff\my_Sep_Doc>dir sep*.*

8. Using the “dir” command

It lists all Windows Files and Directories (folders) in the current directories. This helps the users to quickly see what Files and Directories are present in a particular location

For example, if you want to list the content of ” C:\Users\GFG0338\Desktop\mystuff\my_Doc “, you would type the following. This will give you a list of Files and Directories in that folder along with respective attributes.

How to Change Directories in Command Prompt? - GeeksforGeeks (13)

using dir Command

How Do I Navigate to a Specific Folder in Command Prompt?

When you want to go to a specific folder using Command Prompt, it’s like giving your computer directions. Here’s how to do it in simple steps:

  1. Open Command Prompt: First, you need to open Command Prompt. You can do this by pressing the Windows key, typing “Command Prompt,” and hitting Enter.
  2. Understand Your Starting Point: Before you start, it’s good to know where you are. Command Prompt opens in a default location, usually your user folder.
  3. Type ‘cd’ and Space: To tell Command Prompt you want to change the folder, type `cd` (which stands for “change directory”) followed by a space.
  4. Enter the Folder Name: Now, type the name of the folder you want to go to. If your folder name has spaces, put it in double-quotes. For example, if you want to go to a folder named “My Stuff,” you’d type: cd “My Stuff”
  5. Hit Enter: Press the Enter key on your keyboard. This tells Command Prompt to follow your directions and take you to the folder.
  6. Check Your Location: To make sure you’re in the right place, you can type `cd` without any folder name and press Enter. Command Prompt will show you the full path of where you are.

Note: Remember, you can always use the `cd ..` command to go up one level if you ever want to backtrack.

Conclusion

Mastering the cd command in Command Prompt is crucial for efficient navigation within the Windows environment. With just a few simple commands, you can easily switch directories in Command Prompt and manage your files more effectively. Whether you’re new to Windows or just brushing up on your skills, understanding how to change directory in cmd will streamline your workflow and make using the Command Prompt a breeze.

Also Read

  • Most Useful CMD Commands in Windows
  • 10 Ways to Open the Command Prompt in Windows 10
  • How to Change Colours in Command Prompt in Windows?

How to Change Directories in Command Prompt – FAQs

How can I change the quotes used in Directory of Command Prompt in Windows?

To change the directory in the Command Prompt of Windows, the CD Command will be highly used. The CD Command along with the Directory Name or the entire path will lead you into the desired Directory.

How do I change directories in Command Prompt?

You can change directories in Command Prompt by using the cd command followed by the path of the directory you want to access. For example, cd C:\Users\YourUsername\Documents will take you to the Documents folder.

What is the cd command in Windows used for?

The cd command in Windows is used to navigate folders in Command Prompt. It stands for “change directory” and allows you to move between different directories on your system.

Can I switch directories in Command Prompt to a different drive?

Yes, you can switch directories in Command Prompt to a different drive by typing the drive letter followed by a colon, such as D:, and then using the cd command to navigate to the desired folder.

How can I list all items in any Directory using CMD?

To list all the items of any directory in Command Prompt, first, browse inside the Directory using the CD command or complete file path. Then, use the DIR command only. Executing the DIR Command will list all the items along with their details in CMD.



pooja3005

How to Change Directories in Command Prompt? - GeeksforGeeks (15)

Improve

Next Article

How to Change the Directory in Linux | cd Command

How to Change Directories in Command Prompt? - GeeksforGeeks (2025)
Top Articles
Latest Posts
Recommended Articles
Article information

Author: Gov. Deandrea McKenzie

Last Updated:

Views: 6167

Rating: 4.6 / 5 (46 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Gov. Deandrea McKenzie

Birthday: 2001-01-17

Address: Suite 769 2454 Marsha Coves, Debbieton, MS 95002

Phone: +813077629322

Job: Real-Estate Executive

Hobby: Archery, Metal detecting, Kitesurfing, Genealogy, Kitesurfing, Calligraphy, Roller skating

Introduction: My name is Gov. Deandrea McKenzie, I am a spotless, clean, glamorous, sparkling, adventurous, nice, brainy person who loves writing and wants to share my knowledge and understanding with you.