Type: Internal (2.0 and later)
CHDIR (CD) [d:]path CHDIR (CD)[..]
Purpose: Displays working (current) directory and/or changes to a different directory.
Used to change from one directory to another you specify. The command can be used without the drive designator (d:) if you were changing to a different directory on the current drive. The path designator can indicate a subdirectory within another directory or subdirectory, but it must not exceed 63 characters in length. The command followed by two periods (CD..) can be used to change to the parent directory. Enter CHDIR or CD without a drive and path designation to get a display of the current directory. To learn more about using CHDIR and other fixed-disk commands you may want to do some follow-on reading about manipulating and using fixed disks.
To demonstrate how the CHDIR command accesses the DOS directory structure, assume that two directories, WORDS and FILES have been created on a disk. These two directories are to be found within the root directory. Assume also that an additional directory, LETTERS is to be found within the WORDS directory. To change to the directory LETTERS (that is within the directory WORDS) on the root directory of drive C, enter
The command indicates the path sequentially down through the directory path: the first backslash indicates the root directory, down through the directory WORDS, down to the target directory LETTERS. If you are already working in the WORDS directory, you can change back to the root directory simply by entering
To change to a directory path other than through the root directory, do not enter the leading backslash. For example, if you are working in the WORDS directory, you can change to the LETTERS directory without going through the root directory by entering
A shortcut method to change to the directory immediately above the current directory allows you to enter the CHDIR command followed by two periods. For example, to change from the LETTERS directory to its parent directory, WORDS, enter
Enter it again to change to the next higher directory (in this case, the root directory).