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
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"
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:
Tip: To view a list of all folders (sub-directories) in the current directory in CMD, enter “dir” in Command Prompt.
dir
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:
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
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.
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.
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.
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.
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.
Whenever you open CMD through this shortcut, Command Prompt will automatically start in the directory you’ve entered in the “Start in” field earlier.
In the Windows command prompt (CMD), we use the cd
command to change from one directory to another. However, it only changes the path inside the current drive by default.
If you want to change to a different drive in CMD, you need to use the /d
switch.
cd /d D:
For example, I am working on the command prompt, inside the C:\Users\user1
folder. Now I want to move into a folder called data which is in the D:
drive.
In the above screenshot, you can see that the command didn’t work. The solution is to use the /d
switch.
Alternatively, simply enter the drive letter followed by a colon, as follows:
D:
However, this method only changes to the root of the drive. If you want to go to a folder, you have to use the CD command.
All Windows-related issues might be solved with a program named Command Prompt (CMD). You can feed the Command Prompt with executable commands to perform various administrative functions. For example, the cd or change directory command is used to change the directory path where you are working currently. For instance, the command cd\windows\system32 will switch the directory path to the System32 subfolder within the Windows folder. The Windows cd command is also called chdir, and it can be employed in both, shell scripts and batch files. In this article, you will learn how to change the directory in CMD on Windows 10.
Table of Contents
What are Windows CWD and CD Command?
The Current Working Directory abbreviated as CWD is the path where the shell is currently working. The CWD is mandatory to retain its relative paths. The command interpreter of your Operating System holds a generic command called cd command Windows.
Type the command cd /? in the Command Prompt window to display the name of the current directory or changes in the current directory. After entering the command you will get the following information in Command Prompt (CMD).
CHDIR [/D] [drive:][path] CHDIR [..] CD [/D] [drive:][path] CD [..]
- This .. Specifies that you want to change to the parent directory.
- Type CD drive: to display the current directory in the specified drive.
- Type CD without parameters to display the current drive and directory.
- Use the /D switch to change the current drive /in addition to changing the current directory for a drive.
In addition to Command Prompt, Windows users can also use PowerShell to execute various commands as explained by Microsoft.
Continue reading below to modify/switch to the directories or to a different file path.
Method 1: Change Directory By Path
Use the command cd + full directory path to access a specific directory or folder. Regardless of which directory you are in, this would take you straight to the desired folder or directory. Follow the given steps to do so:
1. Open the directory or folder which you want to navigate in CMD.
2. Right-click on the address bar and then select Copy address, as shown.
3. Now, press the Windows key, type cmd, and hit Enter to launch Command Prompt.
4. In CMD, type cd (the path you copied) and press Enter as depicted.
This will open the directory which path you copied in Command Prompt.
Method 2: Change Directory By Name
Another way for how to change the directory in CMD Windows 10 is to use the cd command to launch a directory level where you are currently working:
1. Open Command Prompt as shown in Method 1.
2. Type cd (directory you want to go to) and hit Enter.
Note: Add the directory name with the cd command to go to that respective directory. e.g. Desktop
Also Read: Delete a Folder or File using Command Prompt (CMD)
Method 3: Go To Parent Directory
When you need to go one folder up, use the cd.. command. Here’s how to change the parent directory in CMD on Windows 10.
1. Open Command Prompt as earlier.
2. Type cd.. and press Enter key.
Note: Here, you will be redirected from the System folder to the Common Files folder.
Method 4: Go To Root Directory
There are many commands to change the directory in CMD Windows 10. One such command is to change to the root directory:
Note: You can access the root directory irrespective of which directory you belong to.
1. Open Command Prompt, type cd /, and hit Enter.
2. Here, the root directory for Program Files is drive C, which is where the cd/ command has taken you.
Also Read: How to create empty files from the command prompt (cmd)
Method 5: Change Drive
This is one of the easiest methods on how to change the directory in CMD on Windows 10. If you want to change the drive in CMD then, you can do so by typing a simple command. Follow the steps listed below to do so.
1. Go to Command Prompt as instructed in Method 1.
2. Type the drive letter followed by : (colon) to access another drive and press Enter key.
Note: Here, we are changing from drive C: to drive D: and then, to drive E:
Method 6: Change Drive & Directory Together
If you want to change the drive and directory together then, there is a particular command to do so.
1. Navigate to Command Prompt as mentioned in Method 1.
2. Type the cd / command to access the root directory.
3. Add the drive letter followed by : (colon) to launch the target drive.
For Example, type cd /D D:\Photoshop CC and press Enter key to go from drive C: to Photoshop CC directory in D drive.
Also Read: [SOLVED] The file or Directory is corrupted and unreadable
Method 7: Open Directory from Address Bar
Here’s how to change the directory in CMD on Windows 10 directly from the address bar:
1. Click on the address bar of the directory you want to open.
2. Write cmd and press Enter key, as shown.
3. The chosen directory will open in Command Prompt.
Method 8: View Inside the Directory
You can also use commands to view inside the directory, as follows:
1. In Command Prompt, use command dir to view the subfolders and subdirectories in your current directory.
2. Here, we can see all directories within C:\Program Files folder.
What happens when Command Extensions are enabled?
If Command Extensions are enabled, CHDIR changes as follows:
- The current directory string is converted to use the same case as the on-disk names. So, CD C:\TEMP would actually set the current directory to C:\Temp if that is the case on disk.
- CHDIR command does not treat spaces as delimiters, so it is possible to use CD into a subdirectory name that contains a space even without surrounding it with quotes.
For example: command: cd \winnt\profiles\username\programs\start menu
is same as the command: cd “\winnt\profiles\username\programs\start menu”
Recommended: How to Fix Git Merge Error
We hope this guide was helpful and you were able to change the directory in CMD Windows 10. Let us know which cd command Windows you think is more useful. Also, if you have any queries or suggestions regarding this article, then feel free to drop them in the comments section.
Download Article
A comprehensive Guide to Changing Directories in the Windows Command Prompt
Download Article
- Opening Command Prompt
- Changing the Directory
- Other Directory Commands
- Troubleshooting
- Q&A
- Tips
- Warnings
|
|
|
|
|
|
Do you want to know how to change directories in the Windows Command Prompt (CMD)? The Windows Command Prompt allows you to use a variety of advanced commands that give you more control over your computer. However, when learning to use the Command Prompt, you will need to learn some basic commands, including how to navigate by changing directories. A directory is just another name for a folder. This wikiHow teaches you how to change directories in the Windows Command Prompt. To make changes in Command Prompt, you must be using an administrator account.
How to Change Directory in CMD: Quick Steps
In Command Prompt (CMD), type «cd» with a space after it, followed by the name of the directory (or drag and drop the directory into CMD from File Explorer). Then press «Enter.»
-
To do so, click the icon with the Windows logo in the taskbar at the bottom of the screen. Alternatively, you can press the Windows key.
- For Windows 8, place your mouse cursor in the top-right corner of the screen, then click the magnifying glass icon when it appears.
-
This will bring up the Command Prompt icon at the top of the Start window.
Advertisement
-
It resembles a black box with a white cursor. This displays a drop-down menu.
-
It’s near the top of the drop-down menu. Doing so will open the Command Prompt with administrator privileges.
- Confirm this choice by clicking Yes when prompted.
- You won’t be able to run Command Prompt in administrator mode if you are not signed into an Administrative account, or if you’re on a restricted, public, or networked computer (e.g., a library or school computer).
Advertisement
-
This command, which stands for «change directory», is the root of any directory change.
- Don’t press the «Enter» key just yet.
- Alternatively, you can type chdir. This command does the exact same thing as «cd.»[1]
-
A directory path is like a map to a specific folder. For example, if the directory to which you want to change is the «System32» folder that’s, in the «Windows» folder on the hard drive, the path would be «C:\Windows\System32\.»
- You can find a folder by navigating to it in File Explorer. Click the address bar at the top to display the path to the folder you are currently in.
- You can display a list of all directories in your current directory in the Command Prompt by typing dir and pressing «Enter.»
-
Your command or address goes after the «cd» command; make sure there is a space between «cd» and your command.
- For example, your whole command might look like cd Windows\System32.
- Alternatively, you can drag and drop a folder from File Explorer into the Command Prompt.
- If the directory is in the current drive you are in, you do not need to type the drive letter at the beginning of the path.
-
Doing so will change the Command Prompt directory to your selected one. The current directory you are in is listed next to the text cursor (i.e. «C:\Windows\System32>».)
Advertisement
-
and press ↵ Enter to go back a directory. If you want to go back one directory (i.e. change from «C:\Windows\System32» to «C:\Windows»), simply type «cd..» with two periods and press «Enter.»
-
If you want to go back to the root of your drive (i.e. go from «C:\Windows\System32» to «C:\»), simply type «cd\» with a back slash and press «Enter.»
-
If you try using the «cd» command to change directories to a directory that is on another drive, you will notice it does not work. You need to change drives before changing to a directory on that drive. To do so, type the drive letter (i.e. «D:») with a colon and press «Enter» to change drives.
- Alternatively, you can type cd /d followed by the complete path (including the drive letter) of a directory on another drive to change directly to that drive (i.e. «cd /d D:\Documents».)
-
If you are not sure what directories are in your current directory, you can display a list of all the directories by typing «dir» and pressing «Enter.»
Advertisement
-
If you receive an error message that says «The system cannot find the path specified,» check to make sure you are spelling the name of the directory correctly. You can see a list of all directories in your current directory by typing dir and pressing «Enter.»
-
If you are spelling is correct and you are still getting the same error, open File Explorer and check to make sure the directory you are navigating to actually exists and that it’s located where you think it’s located.
- If the directory does not exist, you can create a new directory by typing mkdir followed by a space, followed by the name of the directory you want to create. Then press «Enter.»
-
The «cd» command will not allow you to change to a directory on another drive. If you are currently in the «C:» drive, but the directory you want to change to is on the «D:» drive, you will need to change drive letters before changing to a new directly. You can do so by typing the drive letter and pressing «Enter.»
-
If you are not running the Command Prompt as an administrator, you will be limited in what you can do with the Command Prompt. Make sure you are logged into Windows as an Administrator, then right-click the CMD icon in the Start menu and click Run as Administrator.
Advertisement
Add New Question
-
Question
How do I go to C:\ from C:\users\username?
You can either type «cd ..» to take you up a directory level (to C:\users) and once again to take you to the root level, or you can always type «cd \» from any directory to take you to the root level.
-
Question
How do I change the name of a drive, like from Drive H: to drive A:?
In start, type Computer Management. Open Computer Management and click the arrow next to Storage, then Disk Management. Right-click the drive you want to rename and click Change Drive Letter.
-
Question
What is the difference between cd\ and cd?
In order to use cd you have to put a file path after it; cd\ just goes straight to C:\.
See more answers
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
Advertisement
-
Changing the directory is useful when attempting to modify or delete a file in a specific location.
Thanks for submitting a tip for review!
Advertisement
-
Attempting to run a command that is contingent on a specific file or folder while in a different directory will result in errors.
Advertisement
About This Article
Thanks to all authors for creating a page that has been read 2,969,498 times.
Is this article up to date?
-
Home
-
News
- How to Change Directory in CMD | How to Use CD Command Win 10
By Alisa |
Last Updated
This tutorial gives a detailed guide on how to change directory in CMD (Command Prompt) in Windows 10 computer. Learn how to use CD command in Windows Command Prompt to access different directories and folders. FYI, MiniTool software designs a free data recovery software program allowing you to recover any deleted/lost files from Windows 10/8/7 computer and other storage devices.
Windows Command Prompt (cmd.exe) lets you do many things quickly on your Windows computer. Wonder how to change directory in CMD? You can use the CD command to easily do this.
What Is CD Command in Windows?
The CD command refers to “change directory”. It is a professional Windows Command Prompt change directory command. You can use CD command to easily change the current working directory in CMD in Windows 10, and open different directories or folders on your Windows 10 computer. Check how to use CD command to change directory in Command Prompt below.
How to Change Directory in CMD Windows 10
- Open elevated Command Prompt
- Use the CD command to change directory in CMD
How to Change Directory in CMD with CD Command
Step 1. Open Windows Command Prompt Utility
Before you use Command Prompt to change directory, you should enter into Command Prompt at first.
You can press Windows + R, type cmd, and press Ctrl + Shift + Enter to open elevated Command Prompt in Windows 10.
Step 2. How to Use CD Command in CMD to Change Directory
Then you can type CD command lines in CMD to change different directory or folder paths.
If you want to go to a specific directory, you can type cd + full directory path, e.g. cd C:\Program Files.
To open a particular folder, you can type cd + full folder path, e.g., cd C:\Program Files\office.
To go up a directory level you are currently working, you can type cd ..
To check the whole subdirectories and folders in the current directory, you can type dir command.
To go to the root level directory from any directory, you can type cd \.
To change the current drive, you can firstly type cd \ to go to the root directory, and then enter the drive letter followed by a colon to enter the target drive, e.g. I:.
To change the drive and directory at the same time, you can use CD and the /D switch simultaneously, e.g., cd /D I:\MiniTool Partition Wizard 11.
Bottom Line
Now you should know how to change directory in Command Prompt (CMD) by using CD command in Windows 10. You can easily access different directories or folders with CD command Windows in Command Prompt.
If you can’t find a file or folder in your Windows 10 computer, you may lost it or mistakenly deleted it, you can easily recover the file or folder with MiniTool Power Data Recovery.
MiniTool Power Data Recovery is a professional free data recovery program compatible with Windows 10/8/7. You can use this software to easily recover data from various data loss situations.
Namely, you can recover any deleted/lost files from Windows 10/8/7 computer, external hard drive, USB/thumb/pen drive, SD card, and more.
For the data loss due to mistaken file deletion, system crash and other computer system issues, hard drive failure, malware/virus infection, etc. you can use MiniTool Power Data Recovery to easily retrieve the lost files and data.
About The Author
Position: Columnist
Alisa is a professional English editor with 4-year experience. She loves writing and focuses on sharing detailed solutions and thoughts for computer problems, data recovery & backup, digital gadgets, tech news, etc. Through her articles, users can always easily get related problems solved and find what they want. In spare time, she likes basketball, badminton, tennis, cycling, running, and singing. She is very funny and energetic in life, and always brings friends lots of laughs.