Microsoft DOS cd command

Quick links

About CD
Availability
CD Syntax
Examples

About cd

CD (Change Directory) is a command used to switch directories in MS-DOS and the Windows command line.

Availability

The CD command is an internal command and is available in the below Microsoft operating systems.

All Versions of MS-DOS
Windows 95
Windows 98
Windows ME
Windows NT
Windows 2000
Windows XP
Windows Vista
Windows 7

Syntax

Windows XP and later syntax

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

chdir \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.

Windows 98 and earlier syntax

CHDIR [drive:][path]
CHDIR[..]
CD [drive:][path]
CD[..]

Examples

cd\

Goes to the highest level, the root of the drive.

cd..

Goes back one directory. For example, if you are within the C:\Windows\COMMAND> directory, this would take you to C:\Windows>

Windows 95, 98, and later versions have a feature in the CD command that allows you to go back more than one directory when using the dots. For example, typing: cd... with three dots after the cd would take you back two directories.

cd windows

If present, would take you into the Windows directory. Windows can be substituted with any other name.

cd\windows

If present, would first move back to the root of the drive and then go into the Windows directory.

cd\windows\system32

If present, would move into the system32 directory located in the Windows directory. If at any time you need to see what directories are available in the directory you're currently in use the dir command.

cd /d e:\pics

If for example you were on the C: drive, typing the above command with the /d option would first switch the E: drive letter and then move into the pics directory.

cd

Typing cd alone will print the working directory. For example, if you're in c:\windows> and you type the cd it will print c:\windows. For those users who are familiar with Unix or Linux this could be thought of as doing the pwd (print working directory) command.