When you change directories with an automatic directory change or the CD, CDD, or PUSHD command, TCC must find the directory you want to change to. If it cannot find an exact match of the directory path and name, TCC tries to find the directory you requested via the CDPATH, then via an Extended Directory Search.
Enabling both CDPATH and Extended Directory Searches can yield confusing results. If you prefer to explicitly specify where TCC should look for directories, use CDPATH. If you prefer to have TCC look at all of the directory names on your disk, use Extended Directory Searches.
CDPATH is an environment variable, and is similar to the PATH variable used to search for executable files: it contains an explicit list of directories to search when attempting to find a new directory. TCC appends the specified directory name to each directory in CDPATH and attempts to change to that drive and directory. It stops when it finds a match or when it reaches the end of the CDPATH list.
CDPATH is ignored if a complete directory name (one beginning with a backslash \) is specified, or if a drive letter is included in the name. It is only used when a name is given with neither drive letter nor leading backslash.
CDPATH provides a quick way to find commonly used subdirectories in an explicit list of locations. You can create CDPATH with the SET command. The format of CDPATH is similar to that of PATH: a list of directories separated by semicolons. For example, if you want the directory change commands to search the C:\DATA directory, the D:\SOFTWARE directory, and the root directory of drive E: for the subdirectories that you name, you should create CDPATH with this command:
Suppose you are currently in the directory C:\WP\LETTERS\JANUARY, and you'd like to change to D:\SOFTWARE\UTIL. You could change directories explicitly with the command:
[c:\wp\letters\january] cdd d:\software\util
However, because the D:\SOFTWARE directory is listed in your CDPATH variable as shown in the previous example (we'll assume it is the first directory in the list with a UTIL subdirectory), you can simply enter the command
[c:\wp\letters\january] cdd util
or, using an automatic directory change:
to change to D:\SOFTWARE\UTIL.
TCC looks first in the current directory, and attempts to find the C:\WP\LETTERS\JANUARY\UTIL subdirectory. Then it looks at CDPATH, and appends UTIL to each entry in the CDPATH variable. In other words, it tries to change to C:\DATA\UTIL, then to D:\SOFTWARE\UTIL. Because this change succeeds, the search stops and the directory change is complete.
If you often switch between "sibling" directories, i.e., between subdirectories of a common parent directory. you can enter .. as a search entry in your CDPATH. You can use ... to find "uncles", i.e., a directory one level up (a sibling of the parent directory), thus a subdirectory of the directory 2 levels up.