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.
How to Change Directory in CMD on Windows 10
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.