CD (or ChDir)

Index

Changes (or displays) the current directory on the specified drive.

Syntax:

To display the current directory:
CD [drive:]

To change the current directory:
CD path

pathChanges the current directory to path. (If path includes a drive that is not the current drive, see notes below) CD recognizes the \ and .. shortcuts for root and parent directories respectively.

Notes:

At any time, each drive (real and/or virtual - see SUBST) has its own "current directory" which remains "current" until it is changed - ie. changing the current directory of drive c: will not affect the current directory status of any other drive. However, there can, of course, only be one current drive at any one time.

To change to the current directory on a different drive, just enter the drive letter (+ colon). Using CD with a drive letter merely displays the current directory on the other drive without switching to it. The CD command can be used to change the current directory on a "non-current" drive, but will not switch to that directory.

Examples:

If the current drive is c:, to make "c:\docs\data" the current directory:
CD \docs\data

However, if the current directory is "c:\docs", all that is necessary is:
CD data

To change the current directory "c:\docs\data" to the parent directory "c:\docs":
CD..

If the current directory on the c: drive is "c:\data\docs" and the current directory on the e: drive is "e:\downloads", then to copy all files from "e:\downloads" to "c\data\docs":
COPY e:*.* c:

To copy all files from "e:\downloads" to the root directory of c:
COPY e:*.* c:\

File Details:

Internal


This page last revised:
December 9, 1999.