Name

cd or chdir

Synopsis

Display the name of or change the current working directory (folder).

Syntax

cd [/d] [directory]
chdir [/d] [directory]

Description

With no arguments, cd displays the full pathname of the current directory. Given the pathname of an existing directory, it changes the current directory to the specified directory.

If directory is on a different drive (for example, if the current directory is c:\dream and you type cd d:\nightmare), the current working directory on that drive is changed, but the current working drive is not. To change the current drive, use the /d parameter, or simply type the letter followed by a colon, by itself, at the prompt (see the examples below).

Pathnames can be absolute (including the full path starting with the root) or relative to the current directory. A path can be optionally prefixed with a drive letter. The special paths .. and ... (and so on) refer to the parent and grandparent of the current directory, respectively.

Examples

If the current drive is C:, make c:\temp\wild the current directory:

C:\>cd \temp\wild
C:\temp\wild>

Note how the current working directory is displayed in the prompt. If the current directory is c:\temp, all that is necessary is:

C:\temp>cd wild
C:\temp\wild>

Change to the parent directory:

C:\more\docs\misc>cd ..
C:\more\docs>

Change to the grandparent (parent of the parent) directory:

C:\more\docs\misc>cd ...
C:\more>

Change to the root directory of the current drive:

C:\Windows\Desktop\>cd \
C:\>

Change to another ...

Get Windows XP in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.