Hide Comments
Purpose:Display or change the current directory


Format:CD [/D /N /X] [path | -]


pathThe directory to change to, optionally including a drive letter


/D(rive)/X (exclude)

/N(o extended search)


See also: CDD, MD, PUSHD, RD, and Directory Navigation.


Internet:  Can be used with FTP Servers.




CD and CHDIR are synonyms. You can use either one.


CD lets you navigate through a drive's subdirectory structure by changing the current working directory. If you enter CD and a directory name, the named directory becomes the new current directory. For example, to change to the subdirectory C:\FINANCE\MYFILES:


[c:\] cd \finance\myfiles



Every disk drive on the system has its own current directory. Specifying both a drive and a directory in the CD command will change the current directory on the specified drive, but will not change the default drive (unless you use the /D option). For example, to change the default directory on drive A:


[c:\] cd a:\utility



Notice that this command does not change to drive A:. Use the /D option, or preferably the CDD command to change the current drive and directory at the same time.


If path contains white space or special characters (which is valid only for an LFN drive), you must enclose it in double quotes.


If path begins with a ~ (tilde), CD will substitute to the user's home directory, as defined by HOME in the environment. (If HOME doesn't exist, TCC will look for %HOMEDRIVE + HOMEPATH.)


You can change to the parent directory with CD ..; you can also go up one additional directory level with each additional .. For example, CD .... will go up three levels in the directory tree (see Extended Parent Directory Names). You can move to a sibling directory (one that branches from the same parent directory as the current subdirectory) with a command like CD ..\newdir .


If you enter CD with no parameter or with only a disk drive name, it will display the current directory on the default or named drive.


If CD cannot change to the directory you have specified it will attempt to search the CDPATH and the extended directory search database in order to find a matching directory and switch to it. You can disable this default extended search with /N. You can also use wildcards in path to force an extended directory search. Read the section on Directory Navigation for complete details on these and other directory navigation features.


If the TCMD.INI directive EverythingSearch is set, CD will use Everything Search (free at http://www.voidtools.com) instead of JPSTREE.IDX for fuzzy directory searches. Everything Search is slightly faster, but will only work on local NTFS drives. Setting EverythingSearch is the equivalent of setting FuzzyCD=3 (*name*). You must download and install Everything Search yourself; it is not included in the Take Command distribution.


CD saves the current directory before changing to a new directory. You can switch back to the previous directory by entering CD -. (There must be a space between the CD command and the hyphen.)  You can switch back and forth between two directories by repeatedly entering CD -. The saved directory is the same for both the CD and CDD commands. Drive changes and automatic directory changes also modify the saved directory, so you can use CD - to return to a directory that you exited with an automatic directory change. TCC recognizes a single hyphen on the command line as an internal alias for CDD -.


Directory changes made with CD are recorded in the directory history list and can be displayed in the directory history window, which allows you to return quickly to a recently-used directory.


You can also use CD to display or change the current directory on an FTP server opened with IFTP. For example:


cd ftp:



cd ftp:/pub


Note: FTP directory changes use neither the CDPATH feature nor the Extended Directory Searches database.


CD never changes the default drive, unless the /D option is specified. If you change directories on one drive, switch to another drive, and then enter CD -, the directory will be restored on the first drive but the current drive will not be changed.




/DChanges the current drive as well as directory. This option is included only for compatibility with the same option available in some versions of CMD. In most cases you should use CDD, which performs the same function.


/NSkips the standard extended directory search when the directory is not found. This option is useful in batch files to force an error (rather than an extended search) if a directory is not found.


/XDon't save the current directory to the Directory History list.