TCC Filename Completion
TCC is first and foremost a file-management tool. Many of the command lines you type will include a filename or two. Filename completion speeds the process of entering filenames. Customizing filename completion so that it presents only filenames appropriate to the current command saves even more time.
Like colored directories, filename completion can be customized either through an environment variable or via the OPTION dialog. You may want to use the FILECOMPLETION variable while experimenting, but it's ultimately more convenient to enter your final settings in OPTION.
The most obvious completion tweak is for the subdirectory management commands: CD, CHDIR, CDD, MD, MKDIR, RD, RMDIR, and PUSHD. Only subdirectory names make sense in the context of these commands; there is no need for tab completion to offer names of files:
set filecompletion=cd chdir cdd md mkdir rd rmdir pushd:dirs;
Once you have created the FILECOMPLETION variable with SET, you can change it either by recalling your SET command and editing it, or with ESET FILECOMPLETION. When adding new commands to the variable, keep in mind that you will almost certainly want DIRS as well as all appropriate file extensions. For example, when using UNZIP.EXE to extract .ZIP archives, you will often need to specify pathnames to the .ZIP files; you will want to use filename completion to enter those pathnames, so include DIRS along with ZIP:
set filecompletion=unzip:zip dirs;
Once you have FILECOMPLETION set the way you want it, copy it to the clipboard with:
echo %filecompletion > clip:
and you can paste it directly into the OPTION dialog, rather than retyping it. This setting goes on the Command Line tab, in the field labeled Options.
On the subject of filename completion, a few other customizations are worth mentioning. On the Command Line tab of the OPTION dialog, the“Complete hidden files”, “Complete hidden directories”,and “Add ‘\’ to Directories” options are all worth trying out. The first two cause filename completion to offer files and subdirectories with the Hidden and System attributes, as well as normal files and subdirectories. Turn these on if you often work with hidden or system files or subdirectories. The third option, “Add ‘\’ to Directories”, causes filename completion to automatically append a backslash when completing subdirectory names, saving you a few keystrokes.
Finally, executable extensions also affect filename completion. When the cursor is at the start of a line, filename completion only presents subdirectories and executable files. You can override this restriction by typing a space first so that the cursor is not at the start of the line. But doing that gets tedious if you often want to complete other file types at the start of the line. Any executable extensions you define will also be offered at the start of the command line along with subdirectories and executables. For instance, if you frequently launch .DOC and .TXT files from the command line, create executable extensions and filename completion will include them:
You can create an executable extension to open a specified file type using Windows's default handler. For example, to open .HTM files in the current default web browser:
set .htm=start /pgm
Because executable extensions are stored in environment variables, TCSTART.BTM is a good place to define them. If you have many, you can keep them in a text file and load it using SET /R. For instance, you might maintain a list of executable extensions in a file named ENVVARS.TXT in the same directory as Take Command, and add a command like this to your TCSTART.BTM file:
set /r "%@path[%_cmdspec]envvars.txt"
The file read by SET /R — ENVVARS.TXT in this example — should have one variable per line, in the format NAME=VALUE, with no SET command and no spaces around the equals sign, like this:
Copyright © 2011-2023, Charles Dye