TimeTrials plugin for Take Command / TCC / TCC/LE

beta version 0.99.0     2026-08-31

Charles Dye

Purpose:

This plugin provides one new command, TT, for timing other commands. TT runs a command several times, times it, and reports the total and average times.

Installation:

To use this plugin, copy TimeTrials.dll to some known location on your hard drive. (If you are still using the 32-bit version of Take Command, take TimeTrials-x86.dll instead of TimeTrials.dll.) Load the .DLL file with a PLUGIN /L command, for example:

plugin /l c:\bin\tcmd\test\timetrials.dll

If you copy the .dll file to a subdirectory named PlugIns within your Take Command program directory, the plugin will be loaded automatically when TCC starts.

Plugin Features:

New Command:
TT
New Variable:
_TRIALRUN

Syntax Note:

The syntax definitions in the following text use these conventions for clarity:

BOLD CODEindicates text which must be typed exactly as shown.
CODEindicates optional text, which may be typed as shown or omitted.
Bold italicnames a required argument; a value must be supplied.
Regular italicnames an optional argument.
ellipsis…after an argument means that more than one may be given.

Examples are shown in a gray box:

rem   This is an example:
tt `echo %@filesize[/s c:\windows\]`


Some command options take an argument. These are shown with a colon between the option and its argument: /A:arg

If you like, you may substitute an equals sign for the colon: /A=arg This is handy if the arg is a filename, and you want to use tab completion to enter the filename.

Or you can omit the colon: /Aarg

New Command:

TT — Run and time a command repeatedly.

Syntax:
TT /B /D:m,n /E /M /N:n /O:flags /Q /S /U:n command

/Bredirect stdout and stderr to the bit bucket
/D:m,ndrop the m slowest and n fastest runs
/Eexclude runs with errors (nonzero exit codes)
/Mdisplay times as milliseconds
/N:nset the number of runs; the default is 10
/O:flagsdisable features
/Qquietly; no “Run #i of n” lines
/Splay a sound on completion
/U:nabort if the command returns exit code n
commandthe command to time

The command is required. Use `strong quotes` around the command if it contains special characters, or if you want to delay variable expansion until the command runs.

Note that any options must come before the command.


tt `echo %@filesize[/s c:\windows\]`

In the example above, note that we are using strong quotes around the command to delay variable expansion. Without the quotes, the @FILESIZE function would be expanded before TT starts. We would just be timing how long ECHO takes to display a short string. (Spoiler alert: Not very long at all.)

The real goal here is to time, not the ECHO command, but the @FILESIZE function as it grovels over the C:\Windows tree. The strong quotes delay variable expansion until the ECHO command runs.


/D:m,n tells TT to drop the m slowest and the n fastest runs. Either m or n (but not both) may be omitted; omitted values default to zero.

m and n will be added to the number of runs specified with /N:n. For example,

tt /n:20 /d:3,3 testprog.exe

… will run TestProg.exe 26 times, disregarding the three slowest and the three fastest runs, and average the remaining twenty.

/D by itself will drop the single slowest and the single fastest run, like /D:1,1.

/DD will drop the NumRuns/10 slowest and the NumRuns/10 fastest runs, with a minumum of 1 and a maximum of 1000.


If you specify /E, any run of the command which give a nonzero exit code will not be included in the final average.


/O:flags disables command features:

Cdisables the highlight
Fdo not grab focus at the start of each run
Jdoes not simulate mouse movements
Rskips the recap of runtimes and exit codes
Tdo not update the console window’s title bar

/S will play the system ”Asterisk” sound when the final run completes.

You can also use /S:wavfile to specify a custom .wav file to play. There are a few limitations: The complete filename must be less than 256 characters long (PlaySound() limitation). The filename must end in .wav, and the file must exist.



New Variable:

_TRIALRUN — Returns the trial run number, 1 to n.

Syntax:
%_TRIALRUN

This variable is only meaningful within a tt loop.


tt `delay /m %@eval[50 * %_trialrun]`



Startup Message:

This plugin displays an informational line when it initializes. The message will be suppressed in transient or pipe shells. You can disable it for all shells by defining an environment variable named NOLOADMSG, for example:

set /e /u noloadmsg=1

Status and Licensing:

Consider this beta software. It may well have issues. Try it at your own risk. If you find a problem, you can report it in the JP Software support forum.

TimeTrials is currently licensed only for testing purposes. I may make binaries and source code available under some free license once I consider it ready for use.

Download:

You can download the current version of this plugin from https://charlesdye.net/dl/timetrials.zip.