How to Change Directories in Command Prompt

command prompt change directories

The command prompt has a CLI interface. In day to day life, we want to change our directories using  CMD. So here is how to change your directories in command prompt. Also, you must remember, to run this command you must access cmd as administrator. If not you can’t change your directories.

Most commonly we use the “cd” command to change directories as well as we use “chdir” to this task.

The syntax of this command is explained by Change Directories in Command Prompt with some examples.

Change Directories using “cd”

  1. Open Command Prompt
    • Go to starts and search “cmd” Or press win+r keys at the same time.
    • Then type  “cmd” in the text box.
    • Then you have  CMD.
    • Please make sure you have administrator access.
  1. Changing the Directories
    • In your popup command prompt type “cd”. CD stands for “ change directory”.
    • Then don’t press the enter button.  You must mention what is your expecting destination.
    • So go to your file explorer and find your file. After that in top of the window there is your address bar and copy your address.
    • Go to the command prompt again.
    • Then paste the address.
    • Make sure, you have a space between “cd” and file destination.
    • My destination is “System 32”

1.

file explorer address

2.

cd C:\Windows\System32
Change Directories in Command Prompt

OK. Done. You changed your directories successfully.

Change Directories using “chdir”

You can change your directories using “chdir”. “cd” and “chdir” the same thing happen.

So this section you can understand how to change directories using “chdir”.

Firstly you must follow the above method and this article difference is the only command in command prompt.

chdir C:\Windows\System32
Change Directories in Command Prompt

That’s it.

Change drive and directory with a single command

Above guide, you followed how to change directories in the same drive. If you want to access a directory in a different drive you can’t access a directory like this. When you run the command as above guide nothing happens.

So here is the command.

Think you are in the C: drive user folder. (C:\Users). Now you want to access Z: drive Audio folder. Then you must enter the command like this.

C:\Users>cd /D Z:\Audio
cmd change directory

This command changes to the drive Z: and also changes the directory to E:\Audio.

Tips for changing directories in windows command prompt

There are two commands called “popd” and “pushd”. These commands would help you when you managing directories.

How does it work?

Here pushd command is very similar to the cd command. It remembers all your directories you going through.

Here is what happens in “pushd” and “popd”

C:\Users\Sadanjane Malshan>pushd C:\Windows\System32
C:\Windows\System32>
C:\Windows\System32>popd
C:\Users\Sadanjane Malshan>
cmd change directory
Also, you can use “pushd” and “cd” commands to get previous directories. Both are the same.
C:\Users\Sadanjane Malshan>cd C:\Windows\System32
C:\Windows\System32>pushd ..
C:\Windows>pushd ..
C:>
cmd change directory

One thought on “How to Change Directories in Command Prompt

Leave a Reply

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