How to Change Directory/Drive in CMD on Windows 11

Published by Nyau Wai Hoe - Updated on

As you use Windows, there are times you will need to execute commands in the Command Prompt (CMD) to perform certain tasks. There are commands that will only work when they are executed in the right directory. This short guide will show you how to change the directory or drive in CMD on Windows 11.

The commands to change directory or drive can also be used in the Windows Terminal (a new command-line tools and shells similar to CMD) in Windows 11.

Change directory or drive in Command Prompt

In Command Prompt, you can use the CD command to change the current directory to any other directory you want. This is provided if you have access to the directory and if the directory you want to change to does exist.

For example, the command below will change the current directory to “C:\test” in CMD.

cd C:\test

How to change directory in CMD Windows 11

If the directory or path name contains spaces, it’s recommended to use quotes around the directory. For example, the command below will change the directory to “C:\New folder” in CMD.

cd "C:\New Folder"

Use quotes for path name in CMD

To change the current directory to a different drive in CMD, simply enter the drive letter. For example, the command below will change to D: drive.

d:

Change directory to another drive in CMD

Tip: To view a list of all folders (sub-directories) in the current directory in CMD, enter “dir” in Command Prompt.

dir

How to view folders in current directory in CMD

Can’t change directory in CMD

If the CD command does not work to change directory or drive in CMD, it is because CD is usually used for changing directory in the same drive. If you want to change the directory to a different drive, for example, from C: to D: drive, just type D: in the command prompt.

D:

Change directory to another drive in CMD

After changing the drive, you can then continue using the CD command to change the directory in that drive in CMD.

Alternatively, you can force use CD with a switch “/d” to tell the command prompt you are switching to another drive using the CD command. For example, the command below will change from any directory or drive to “D:\folder\sample” using CD command.

cd /d d:\folder\sample

How to change drive in CMD Windows 11

The system cannot find the path specified error in CMD

Note that if the directory you are changing to does not exist, command prompt will return an error that says “The system cannot find the path specified“. Check the path name and try again.

The system cannot find the path specified CMD Windows 11

Unable to change directory in CMD because “Access is denied”

If you receive the “Access is denied” error when you try to CD to a directory, it means that you do not have the privileges required to access the folder or directory. If you are an administrator in the system and you do own the folder, take ownership of the folder and try again. Read: How to Take Ownership of a File, Folder or Drive in Windows 11.

Access is denied CMD

Change default directory in CMD on Windows 11

By default, if you open Command Prompt from the Start menu or Run window, it will usually open in your Windows profile directory which is something like C:\users\alvin. Or, if you run CMD as administrator, it will always start in C:\Windows\system32.

There is no setting that allows you to change the default directory if you start CMD from Start or Run. However, there is a workaround to force CMD to start in any directory you want it to. You can create a shortcut pointing to cmd.exe and configure the Start in field to any directory you want the command prompt to start in. Here’s how to do it.

First, right-click anywhere on the desktop and select New > Shortcut to create a shortcut.

Create desktop shortcut Windows 11

In the Create Shortcut wizard, enter the path to cmd.exe, in most cases, it should be in “C:\WINDOWS\system32\cmd.exe“. Change the C: drive if your Windows is installed on a different drive. Click Next to continue. Give your shortcut any name you like and click Finish to complete the wizard.

Create shortcut for CMD Windows 11

Next, right-click the newly created shortcut and select Properties. Then, go to the Shortcut tab. In the Start in field, enter the default directory where you want CMD to start in when you open this shortcut. Click OK to save the changes.

Change default directory in CMD Windows 11

Whenever you open CMD through this shortcut, Command Prompt will automatically start in the directory you’ve entered in the “Start in” field earlier.

Start CMD in another drive or directory Windows 11

Categories: ComputingWindows 11

Nyau Wai Hoe
Nyau Wai Hoe is the Founder and Chief Editor of WindowsDigitals.com. With a degree in software engineering and over 12 years of experience in the tech support industry, Nyau has established himself as an expert in the field, with a primary focus on the Microsoft Windows operating system. As a tech enthusiast, he loves exploring new technologies and leveraging them to solve real-life problems.

Share via
Copy link