cd or chdir


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


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


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.


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

C:\>cd \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

Change to the parent directory:

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

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

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

Change to the root directory of the current drive:

C:\Windows\Desktop\>cd \

Change to another ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.