How to Change Directory in CMD Windows 10

By | March 22, 2022

We can switch directories in Windows using the command cd. It is the same command as both cd and chdir. Below you will find an explanation of the syntax of this command.

How to change directory in cmd from c to d –

How to Change Directory in CMD Windows 10
Command prompt launches by default from the directory C:\Documents and Settings\logind. The following is an example from Windows XP. Normally, Windows 7 opens the command prompt in the folder C:\Users\loginid. Imagine navigating to the directory C:\Windows\System32. Here is what you need to do.

C:\>cd C:\Windows\System32


chdir  C:\Windows\System32

The directory name needs to be changed to include spaces:

When we name directories in Windows, we can include spaces. Space can be correctly interpreted by the cd command. The directory name need not be enclosed in quotes as with many other Windows commands. A sample is provided below.

C:\>cd   C:\Documents and Settings\cmdadmin
C:\Documents and Settings\cmdadmin>

With a single command, you can change both the drive and directory:

It is not possible to change to a directory on another drive by using the basic cd command. Let’s say you are in the C:/users/cmdadmin/ directory. You would like to change to the E:\docs directory.
When you run cd e:/docs, no error will appear, but you will be in the same folder. During this process, you will not be able to move into the folder e:/docs until you switch drives using the command E:. By selecting /d when using cd, you can avoid this issue.

Cd /D E:\docs

The directory E:/docs is also changed to E:/docs after this command.

How to Change Directory in CMD Windows 10?

Using the following tips will simplify changing directories in the command line if you often use the Windows command line.

When Pushd and Popd are used:

In addition to saving the path to the current directory, the pushd command is similar to the cd. In this case, if you do not wish to return to your previous directory, you can use popd. You will be taken to your last working directory.

C:\Program Files\Microsoft Office> pushd c:\WINDOWS\system32
C:\WINDOWS\system32> popd
C:\Program Files\Microsoft Office>

As long as you use pushd instead of cd to change directories, Pushd can remember all the previous directories you traversed. You can jump backward in time by using popd to explore the previously visited folders. For an example, see below.

C:\WINDOWS\system32\drivers> pushd ..\
C:\WINDOWS\system32> pushd ..
C:\WINDOWS> pushd ..
C:\> pushd "c:\Program Files"
C:\Program Files> popd
C:\> popd
C:\WINDOWS> popd

You may also like: Run Command for Device Manager – CMD from Admin

Leave a Reply

Your email address will not be published. Required fields are marked *