Windows how to change directory in cmd

I'm using cmd.exe (C:WINDOWSSystem32cmd.exe) and I have to change my current directory to "D:temp" i.e. temp folder in the D drive. When I try to cd nothing happens. C:> cd D:temp C:&g...

I’m using cmd.exe (C:WINDOWSSystem32cmd.exe) and I have to change my current directory to «D:temp» i.e. temp folder in the D drive.

When I try to cd nothing happens.

C:> cd D:temp

C:>

I don’t know what else to do here. Even pressing tab key does not give any hints. I have never got the reason to use cmd.exe until now when I have to. I mostly use Linux for development.

If this helps: I’m on a remote login to another computer and D:temp in on the remote machine, but so is C: where I have opened the terminal (cmd.exe).

Mofi's user avatar

Mofi

44.7k16 gold badges77 silver badges137 bronze badges

asked Jul 19, 2013 at 19:25

A. K.'s user avatar

5

The «cd» command changes the directory, but not what drive you are working with. So when you go «cd d:temp», you are changing the D drive’s directory to temp, but staying in the C drive.

Execute these two commands:

D:
cd temp

That will get you the results you want.

answered Jul 19, 2013 at 19:27

Mark Nenadov's user avatar

Mark NenadovMark Nenadov

6,2515 gold badges22 silver badges29 bronze badges

3

Another alternative is pushd, which will automatically switch drives as needed. It also allows you to return to the previous directory via popd:

C:Temp>pushd D:somefolder
D:somefolder>popd
C:Temp>_

answered Jul 19, 2013 at 20:18

Ansgar Wiechers's user avatar

Ansgar WiechersAnsgar Wiechers

189k23 gold badges240 silver badges313 bronze badges

2

cd has a parameter /d, which will change drive and path with one command:

cd /d d:temp

( see cd /?)

answered Jul 19, 2013 at 20:12

Stephan's user avatar

StephanStephan

52.9k10 gold badges57 silver badges90 bronze badges

1

You can try this it works for me

C:Usersuser>cd..
C:Users>cd ..
C:>D:
D:>cd foldername

answered Dec 18, 2021 at 19:09

Jannatul Fardous's user avatar

Just type your desired drive initial in the command line and press enter

Like if you want to go L:\ drive,
Just type L: or l:

answered Nov 13, 2020 at 7:17

danialcodes's user avatar

Use Command

G: D:         <!--Move to D Drive-->

D: cd temp      <!--Move to temp Folder-->

answered Sep 27, 2022 at 6:18

Munna Kumar's user avatar

Munna KumarMunna Kumar

3073 silver badges7 bronze badges

cd /driveName driveName:pathNamw

answered Jan 4, 2021 at 6:20

pushpendra's user avatar

1

You can use these three commands:
1.cd.. 2.d: 3.cd temp

answered Sep 18, 2021 at 11:03

Divyanshu's user avatar


Download Article


Download Article

This wikiHow teaches you how to change the folder (also known as the «directory») in which your Windows computer’s Command Prompt program operates. To make changes in Command Prompt, you must be using an administrator account.

Things You Should Know

  • Open start and type cmd. Right click Command Prompt and click Run as administrator.
  • Type cd and enter your directory’s path. The path can be found by looking at the address at the top of the folder you are directing to.
  • Press Enter.
  1. Image titled Change Directories in Command Prompt Step 1

    1

    Open Start. Either click the Windows logo in the bottom-left corner of the screen, or press the Win 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.
  2. Image titled Change Directories in Command Prompt Step 2

    2

    Type in cmd. This will bring up the Command Prompt icon at the top of the Start window.

    Advertisement

  3. Image titled Change Directories in Command Prompt Step 3

    3

    Right-click Command Prompt. It resembles a black box. This invokes a drop-down menu.

  4. Image titled Change Directories in Command Prompt Step 4

    4

    Click Run as administrator. It’s near the top of the drop-down menu. Doing so will open 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’re on a restricted, public, or networked computer (e.g., a library or school computer), or an otherwise non-administrator account.
  5. Advertisement

  1. Image titled Change Directories in Command Prompt Step 5

    1

    Type in cd . Make sure you include the space after «cd». This command, which stands for «change directory», is the root of any directory change.

    • Don’t press the Enter key.
  2. Image titled Change Directories in Command Prompt Step 6

    2

    Determine your directory’s path. 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:WINDOWSSystem32».

    • You can find a folder’s path by opening My Computer, double-clicking the hard drive icon, navigating to your destination, and then looking at the address at the top of the folder.
  3. Image titled Change Directories in Command Prompt Step 7

    3

    Type in your directory’s path. 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 WindowsSystem32 or cd D:.
    • Since your computer’s default directory location will be the hard drive (e.g., «C:»), you don’t need to type in the hard drive’s name.
  4. Image titled Change Directories in Command Prompt Step 8

    4

    Press Enter. Doing so will change the Command Prompt directory to your selected one.

  5. Advertisement

Add New Question

  • Question

    How do I go to C: from C:usersusername?

    Community Answer

    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:?

    Community Answer

    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?

    Community Answer

    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.

  • Some common Command Prompt directory commands include the following:

    • D: or F: — Change the directory to the disk drive or an attached flash drive.
    • .. — Move the current directory up by one folder (e.g., «C:WindowsSystem32» to «C:Windows»).
    • /d — Changes the drive and the directory at the same time. For example, if Command Prompt is in the disk drive («D:»), typing «cd /d C:Windows» would move you to the Windows directory on the hard drive («C:»).
    • — Takes you to the root directory (e.g., the hard drive).

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

Article SummaryX

1. Open Command Prompt.
2. Type in cd followed by a space.
3. Type in your preferred directory command or path.
4. Press Enter.

Did this summary help you?

Thanks to all authors for creating a page that has been read 2,432,652 times.

Is this article up to date?

Type cmd into the Windows search bar to get started

Updated on September 27, 2022

What to Know

  • Type cmd into the Windows 11 or Windows 10 search bar to open the command prompt.
  • Type cd followed by a space, and then drag the folder or type the name of the folder into the command prompt.
  • Check that your syntax is correct if directory changes don’t work.

This article teaches you two different methods to change directories in the command prompt in Windows 11 and Windows 10. It also teaches you what to do if you’re unable to change directories. 

How to Open the Command Prompt in Windows 11 and 10

Before you can navigate around the command prompt in Windows 11 and 10, it’s useful to know how to open the command prompt. Here’s how to do so.

  1. On the Windows 11 or 10 search bar, type cmd.

  2. Select Open or click Run as Administrator to open the command prompt with full access rights to do whatever you need to do.

How Do I Change Directories in Command Prompt?

Changing directories in the command prompt can be a lot simpler than you’d think. Here’s one method of doing so. This method works in both Windows 11 and Windows 10.

  1. Type cd followed by a space in the command prompt window.

  2. Drag and drop the folder you want to browse into the window.

  3. Press Enter.

How Do I Navigate to a Folder in Command Prompt?

If drag and drop isn’t convenient or accessible, or you’d prefer to type your commands, there’s another way of navigating to a folder in the command prompt easily enough. Here’s how to do so in Windows 11 and 10.

You’ll need to know the name of the directory. 

  1. In the command prompt window, type cd followed by the folder’s name you wish to find.

    This only works for immediate folders straight after the one you’re in.

  2. Alternatively, type cd namename to go down two levels of documents at once. For example: cd AdminDownloads

  3. If you want to go back one directory, type cd .. to go up a level before typing cd to go back to the original option. 

    If you feel lost within the directory, type dir and press enter to view the contents of the directory you’re in.

Why Can’t I Change Directory in CMD? 

If you can’t change directories within the command prompt, you may be doing something wrong or have your permissions set incorrectly. Here are some things to bear in mind that should make it simple to change directories again. 

  • Check you are typing the correct command. Make sure to start your command by typing cd. You may have mistyped something or typed too many characters. Be sure you’re accurate in your syntax usage. 
  • Check the directory exists. Check the directory you’re trying to browse to exists; otherwise, your command won’t work. Type dir to check the contents of a folder. 
  • Check you’re browsing the correct hard drive. If you have multiple hard drives installed, check you’re browsing the correct one. Change hard drives by typing X: where X is the letter of the hard drive. 
  • Check you have admin permissions. Check you’re running the command prompt as an Administrator; otherwise, you may be limited with what you can do.

FAQ

  • What is Command Prompt?

    It’s a command-line interpreter program that’s available on all Windows PCs. It’s often used to perform more advanced administrative functions or to troubleshoot an issue. The commands you can use depend on which version of Windows you own.

  • How do you clear Command Prompt?

    Type cls and press Enter. This clears all of the previous commands you entered.

  • Can I use copy/paste in Command Prompt?

    Yes, but you need to enable it first. Open Command Prompt, right-click on the top bar, and select Properties. Under Edit Options, select the checkbox next to Use Ctrl+Shift+C/V as Copy/Paste.

  • What is an elevated command prompt?

    Specific commands require an elevated Command Prompt to run. You’ll know you need this if you get an error message about having insufficient privileges or needing administrator-level access. To elevate Command Prompt, run it as an administrator.

Thanks for letting us know!

Get the Latest Tech News Delivered Every Day

Subscribe

Improve Article

Save Article

  • Read
  • Discuss
  • Improve Article

    Save Article

    Cd is the abbreviation or synonym for chdir. It is a command found inside the Windows Command Processor (cmd) that allows for change of the current working directory of a shell instance. The CWD (Current Working Directory) is a path (of a directory) inside the file system, where the shell is currently working. The current working directory is essential for resolving relative paths. Cd is a generic command found in the Command Interpreter of most operating systems.

    Description of the Command :
    Displays the name of or changes the current directory.

    CHDIR [/D] [drive:][path]
    CHDIR [..]
    CD [/D] [drive:][path]
    CD [..]
    
    ..   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.

    • Some of the output is truncated due to its large length.
    • In order to obtain the above text execute the cd /? command on cmd.
    • It should be noted that chdir is an alias for cd, and therefore can be replaced for all of its occurrences.

    Using the Command :

    1. Displaying the Current Working Directory :
      Displaying the current working directory is not generally not required on cmd. This is because the default prompt in cmd displays the Current drive and path (CWD) along with the greater than sign ( > ) at all times ($P$G code). But for the sake of completeness, we would be describing it as well. To display the Current Working Directory, execute the cd command without any arguments.

      Syntax :

      cd

      Apparent from the above output, it is not necessary for us to print the cwd as it is already being displayed by the prompt. Throughout the article, we will be using C:Users as our CWD.

    2. Changing the CWD :
      We can change the Current Working Directory to different paths in the system. The following are the options –

      1. To a Directory of Current Drive :
      To change the working directory, execute command cd followed by an absolute or relative path of the directory you are wanting to become the CWD. Where the path should qualify the following criteria –

      • The Path should be of a Directory.
      • The Directory should be existing.
      • Path can be absolute or relative. If a relative path is used, then the path should be relative to the CWD.

      Syntax :

      cd [Path]

      2. To a Directory of Another Drive :
      To change the working directory to another drive, execute command cd /D followed by a path to a directory. The path should qualify the following criteria –

      • The path should be absolute.
      • The path should contain the drive letter followed by a drive qualifier (DRIVE_LETTER & COLON).

      Syntax :

      cd /d [Path]

      3. An additional way to change the CWD to another drive without the usage of the cd command is to execute the drive letter followed by a colon.

      Syntax :

      (Drive_Letter):

    Понравилась статья? Поделить с друзьями:
  • Windows hosts process в автозагрузке что это
  • Windows host process windows services что это за программа
  • Windows host process rundll32 что это в автозагрузке
  • Windows host process rundll32 не работает
  • Windows host process rundll32 не отвечает