MS-DOS Commands :: cd (change directory)


When you are using a Microsoft MS-DOS command window, MS-DOS works on one directory at a time. The "current" directory is indicated as part of the command prompt.

For example, the command prompt "C:\mystuff\ebooks>" means that the current directory is the "ebooks" directory which is located inside the "mystuff" directory on the c: drive.

Use the cd command to make a different directory the "current" directory ("cd" is short for "change directory").

The command can be typed as either:

cd  directory


cd  drive:directory

For example, "cd \mystuff" will make "\mystuff" the current directory. To get to the "root" (top level directory) of your c: drive, type cd \

If directory contains spaces, then enclose it with quotation marks. For example: cd "C:\Documents and Settings\CCC\My Documents\My Music" or cd "My Music"

Command Variations:

cd  directory
cd  drive:directory

Make the specified directory directory (or drive:directory) the current directory.

The directory can start with a \ or be relative to the current directory. For example, if the current directory is C:\mystuff then typing cd ebooks will change the current directory to C:\mystuff\ebooks (assuming that there is in fact a ebooks sub-directory inside C:\mystuff).

Note: Each drive (c:, d:, e:, etc.) has its own current directory. That's why there is the drive:directory variation of the cd command. For example: cd e:\photos will set the current directory of the e: drive to \photos. To switch to the e: drive, you would simply type e: and press the Enter key.

cd  /d  drive:directory

Make the specified directory directory the current directory and also switch do the drive: drive.

Tip: To make cd always do /d without you having to type it, create a command macro named cd by typing: doskey cd = cd /d $*

cd  ..

You can also type cd .. (the two dots are required) to back out one level out of the current directory. For example, if the current directory is C:\mystuff\ebooks then typing cd .. will change the current directory to C:\mystuff


If you type cd without specifying a directory, the cd command will display the directory path of the current directory. Typically you will not use this variation of the cd command since the directory path is shown in the command prompt. It is more useful in batch files.

help cd

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 current drive in addition to changing current
directory for a drive.

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
CD into a subdirectory name that contains a space without surrounding
the name with quotes.  For example:

    cd \winnt\profiles\username\programs\start menu

is the same as:

    cd "\winnt\profiles\username\programs\start menu"

which is what you would have to type if extensions were disabled.

(Enlarge: help cd)

Related Commands:

To see what directories are available for you to cd into, use the dir command.
To make a new directory, use the md (or mkdir) command.