CD or CHDIR

(from Current Directory or Change Directory)

Changes the current directory or displays its name and path.

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

Where:

  • /D - Changes the current drive.
  • .. - Goes to the parent directory.
  • [drive:][path] - Specifies the drive and path.

Not specifying any options displays the current directory.

Examples:

1. Change the current directory by moving to the parent directory:

chdir ..

or:

cd ..

The result is that, if previously the current directory was C:\Documents and Settings\user, after executing the command it will become C:\Documents and Settings.

 

2. Change the current directory to F:\dumpling\granny\puff\silly little programs (note that quotes are not needed for file names containing spaces for this command):

chdir /d F:\dumpling\granny\puff\silly little programs

or:

cd /d F:\dumpling\granny\puff\silly little programs

 

3. Display the current directory:

chdir

or:

cd

Comments