Skip to main content

TCC Colorized Directories in DIR and PDIR

DIR is one of the most often-used commands. In TCC, it's easy to colorize DIR's output so that the file types you are interested in will stand out and grab your attention. While you can create a riot of color combinations, directory coloring is often more helpful if you use it to highlight just a few file types. Think about which file extensions you most often search for in a directory listing; then colorize just those extensions.

There are two ways to define directory colors. The first is to create an environment variable named COLORDIR, and the second is through the Directory Colors field in the OPTION dialog. At the command line it's easier to use the environment variable to experiment with directory colorizing; the OPTION setting is nice for a more permanent configuration. (If both are set, the environment variable takes precedence and the OPTION setting is ignored.) Start by creating a COLORDIR variable with the SET command; for example, to color subdirectories bright blue,

set colordir=dirs:bri blu;txt:bri yel;

To test different values, you can recall the SET command from the command history and modify it, or you can use ESET COLORDIR to edit the value directly.

Once you've got directory coloring configured the way you want it, enter your settings into the OPTION dialog. You can copy the current value of the COLORDIR variable onto the clipboard by typing

echo %colordir > clip:

Start the OPTION dialog and select the Windows tab. Click in the Directory Colors field and delete its current contents (if any), then press Control-V to paste in your new value.

This setting also colors the SELECT and PDIR commands.


Copyright © 2014-2023, Charles Dye