Please enable JavaScript to view this site.

Take Command / TCC Help v. 29

Navigation: TCC > Command Line > Directory Navigation

Extended Directory Searches

Scroll Prev Top Next More

When you change directories with an automatic directory change, CD, CDD, or PUSHD command, TCC must find the directory you want to change to. To do so, it first checks to see whether you have specified either the name of an existing subdirectory below the current directory, or the name of an existing directory with a relative or full path or a drive letter. If you have, TCC changes to that directory, and does no further searching.


This search method requires that you navigate manually through the directory tree, and type the entire name of each directory you want to change to. Extended Directory Searches speed up the navigation process dramatically by allowing TCC to find the directory you want, even if you only enter a small part of its name.


When the first search method fails, TCC tries to find the directory you requested via the CDPATH variable, then via an Extended Directory Search. This section covers only Extended Directory Searches, which are more flexible and more commonly used than CDPATH.


Extended Directory Searches use a database of directory names to facilitate changing to the correct directory. The database is used only if Extended Directory Searches are enabled, and if the explicit directory search and CDPATH search fail to find the directory you requested.


An extended directory search automatically finds the correct path to the requested directory and changes to it if that directory exists in your directory database. If more than one directory in the database matches the name you have typed, a popup window appears and you can choose the directory you want.


If the TCMD.INI directive EverythingSearch is set (OPTION / Startup / Everything Search), TCC will use Everything Search ( instead of its own database for fuzzy directory searches. Everything Search is faster, but will only work on local NTFS drives. Setting EverythingSearch is the equivalent of setting FuzzyCD=3 (*name*). The Take Command installer will install Everything Search automatically.


You can move and/or resize the directory search window. TCC will use the new position and size the next time the directory search window is invoked. You can also change the keys used in the popup window with key mapping directives.


To use extended directory searches, you must explicitly enable them (see below) and also create the directory database.


The Extended Search Database


To create or update the database of directory names, use the CDD /S command. When you create the database with CDD /S, you can specify which drives should be included. If you enable Extended Directory Searches and do not create the database, it will be created automatically the first time it is required, and will include all local hard drives.


The database is stored in the file JPSTREE.IDX. You can specify a location for this file on the Command Line tab of the configuration dialogs. If this option isn't set, TCC looks for an existing JPSTREE.IDX in the LOCALAPPDATA directory (an environment variable predefined by Windows). If the file doesn't exist, TCC will create it in the "C:\ProgramData\JP Software" directory.


If you use an internal command to create or delete a directory, the directory database is automatically updated to reflect the change to your directory structure.


The TREEEXCLUDE variable can be used to specify which drives/directories should be excluded from inclusion in the directory database.


The internal commands which can modify the directory structure and cause automatic updates of the file are MD, RD, COPY /S, DEL /X, MOVE /S, and REN. The MD /N command can be used to create a directory without updating the directory database. This is useful when creating a temporary directory which you do not want to appear in the database.


Enabling Extended Searches


To enable extended directory searches and control their operation, you must set the Search Level on the Command Line tab of the configuration dialogs.


If Search Level = 0, extended searches are disabled, the JPSTREE.IDX database is ignored, and CD, CDD, PUSHD and automatic directory changes search for directories using only explicit names and CDPATH. This is the default.


If Search Level = 1 and an extended search is required, TCC will search the JPSTREE.IDX database for directory names which exactly match the name you specified.


If Search Level = 2 and an extended search is required, TCC will search the database for exact matches first, just as when Search Level = 1. If the requested directory is not found, it will search the database a second time looking for directory names that begin with the name you specified.


If Search Level = 3 and an extended search is required, TCC will search the database for exact matches first, just as when Search Level = 1. If the requested directory is not found, it will search the database a second time looking for directory names that contain the name you specified anywhere within them.


For example, suppose that you have a directory called C:\DATA\MYDIR, CDPATH is not set, and C:\DATA is not the current directory on drive C:. The following chart shows what CDD command you might use to change to this directory.


Search Level

Type of extended search

Typical CDD Command


CDPATH only (default)

cdd c:\data\mydir


CDPATH or exact match

cdd mydir


CDPATH or leading match

cdd myd


CDPATH or any match

cdd yd


An extended directory search is not used if you specify a full directory path (one beginning with a backslash \, or a drive letter and a backslash). If you use a name which begins with a drive letter (e.g. C:MYDIR), the extended search will examine only directories on that drive.


Forcing an Extended Search with Wildcards


Normally you type a specific directory name for TCC to locate, and the search proceeds as described in the preceding sections. However, you can also force TCC to perform an extended directory search by using wildcard characters in the directory name. If you use a wildcard, an extended search will occur whether or not extended searches have been enabled.


When TCC is changing directories and it finds wildcards in the directory name, it skips the explicit search and CDPATH steps and goes directly to the extended search.


If a single match is found, the change is made immediately. If more than one match is found, a popup window is displayed with all matching directories.


Wildcards can only be used in the final directory name in the path (after the last backslash in the path name). For example you can find COMM\*A* (all directories whose parent directory is COMM and which have an A somewhere in their names), but you cannot find CO?M\*A* because it uses a wildcard before the last backslash.


If you use wildcards in the directory name as described here, and the extended directory search database does not exist, it will be built automatically the first time a wildcard is used. You can update the database at any time with CDD /S.


Internally, extended directory searches use wildcards to scan the directory database. If Search Level is set to 2, an extended search looks for the name you typed followed by an asterisk (i.e. DIRNAME*). If Search Level is set to 3, it looks for the name preceded and followed by an asterisk (i.e. *DIRNAME*).


These internal wildcards will be used in addition to any wildcards you use in the name. For example if you search for ABC?DEF (ABC followed by any character followed by DEF) and Search Level is set to 3, TCCwill search the directory database for *ABC?DEF*.


Disabling Extended Searches in Batch Files


When writing batch files you may want to use the CD or CDD command to switch directories without triggering an extended search. For example, you may need the search to fail (rather than search the extended search database) if a directory does not exist, or you may want to ensure that the extended search popup window does not appear in a batch file designed to run in unattended mode.


To disable extended searches, use the /N option of CD or CDD. When this option is used and a directory does not exist below the current directory or on the CDPATH, the command will fail with an error message, and will not search the extended search database. For example this command might trigger an extended search:


cdd testdir


but this one will not:


cdd /n testdir


Note that this option is not available for PUSHD. To perform the same function when using PUSHD, save the current directory with PUSHD (without parameters) and then use CDD /N to change directories, for example:



cdd /n testdir