Filename Completion

Filename completion can help you by filling in a complete file name on the command line when you only remember or want to type part of it. Filename completion can be used at the command line, which is explained here, and in a filename completion window.


In addition to file names, you can optionally complete alias names (see the CompleteAliases .INI directive), and internal command names (see the CompleteInternals .INI directive) when the argument is at the beginning of the command line.


Filename Completion Keys:


F8 or Shift-TabGet the previous matching filename.
F9 or TabGet the next matching filename.
F10Keep the current matching filename and display the next matching name immediately after the current one.
F12Repeat the filename just returned from an F9 / Tab match.
Alt+F9Restore the original filename mask after a previous F9 or Tab. (This will only work provided you haven't terminated the completion loop; i.e. by pressing anything other than Tab, Shift-Tab, F8, F9, F10, or F12.)
Ctrl+AToggle between long and short filename.
Shift+F6Toggle between the default files + directories filename completion, and directories only. The default will be reset on a new command line.
Ctrl+F6Toggle between completing files found in the local directory, and completing them in the local directory + all of the directories in PATH.


Note: The keystrokes shown above are the default values. See Key Mapping Directives for details on how to assign different keystrokes.


For example, if you know the name of a file begins AU but you can't remember the rest of the name, type:


copy au


and then press the Tab key or F9 key. TCC will search the current directory for filenames that begin with AU and insert the first one onto the command line in place of the AU that you typed.


If this is the file that you want, simply complete the command. If TCC didn't find the file that you were looking for, press Tab or F9 again to substitute the next filename that matches your pattern (in the above example, begins with AU). When there are no more filenames that match your pattern, the system will beep each time you press Tab or F9.


If you go past the filename that you want, press Shift-Tab or F8 to back up and return to the previous matching filename. After you back up to the first filename, the system will beep each time you press Shift-Tab or F8.


If you want to enter more than one matching filename on the same command line, press F10 when each desired name appears. This will keep that name and place the next matching filename after it on the command line. You can then use Tab (or F9) and Shift-Tab (or F8) to move through the remaining matching files.


The pattern you use for matching may contain any valid filename characters, as well as wildcard characters and extended wildcards. For example, you can copy the first matching .TXT file by typing


copy *.txt


and then pressing Tab.


If you don't specify part of a filename before pressing Tab, TCC will match all files. For example, if you enter the above command as "COPY ", without the *.TXT, and then press Tab, the first filename in the current directory is displayed. Each time you press Tab or F9 after that, another name from the current directory is displayed, until all filenames have been displayed. Note: you must terminate the command (e.g., by space) before file completion becomes available.


TCC will append * to the name on LFN drives, and *.* on drives which only support short file names. If you are typing a group of file names in an include list, the part of the include list at the cursor will be used as the pattern to match.


When filename completion is used at the start of the command line, it will only match directories, executable files, and files with executable extensions (and optionally aliases or internal commands, if you have set CompleteAliases and/or CompleteInternals), since these are the only file names that it makes sense to use at the start of a command. If a directory is found, a \ will be appended to it to enable an automatic directory change. If you need to complete the name of any other file at the start of the command line, press Space before starting to type the name. Filename completion will then match any name, not just directory and executable names. Note that you can also "execute" files whose extension has an association in the Windows Registry, but such files are not considered executable by TCC, and only the method above using a space will work.


Filename completion occurs in the physical order in which matching filenames are stored in the directory, the same order in which DIR /O:U would list them. That order is determined by the underlying file system.


TCC will automatically expand variable names embedded in the filename being completed.


TCC also supports network server and sharename completion. If the filename begins with \\, the completion routines will enumerate the network resources for matching server and/or share names. You can control the way server name completion functions with the Server Completion configuration option.


Filename completion will search the PATH for an executable filename if you have set theSearch Path option in the Command Line configuration tab, and you are :


(1)at the beginning of the command line, and
(2)there are no matching entries in the current directory, and
(3)the name you are attempting to match doesn't contain a full or partial path specification.


If all three conditions are met, filename completion will return the first matching executable found in the PATH.


If you are on an NTFS drive, you can also complete stream names. For example:


copy test:t


and then pressing Tab will search the file test for streams beginning with "t". Note that you cannot complete a filename and a stream name simultaneously (i.e., t*:t*).


Programmable tab completion is supported using any scripting language supported by TCC (i.e., BTM/CMD, Lua, Python, REXX, Tcl, etc.). See TABCOMPLETE for details.


Several topics are related to filename completion. See:


Onestep        Converting Between Long and Short Filenames

Onestep        Appending Backslashes to Directory Names

Onestep        Customizing Filename Completion

Onestep        Filename Completion Window

Onestep        Variable Name Completion