Please enable JavaScript to view this site.

Take Command / TCC Help v. 26

Navigation: TCC > Commands

HISTORY

Scroll Prev Top Next More
Purpose:Display or modify the history list

 

Format:HISTORY [/= /A command /F["..."] /G /GL /L /LL /M /N /P /Rn filename /Tn /V]

 

commandA command to be added to the history list.
filenameThe name of a file containing entries to be added to the history list.

 

 

See also: DIRHISTORY, HistoryExclude and LOG.

 

Usage:

 

TCC keeps a list of the commands you have entered on the command line. See Command History and Recall for information on command recall, which allows you to use the history list to repeat or edit commands you have previously executed.

 

The HISTORY command lets you view and manipulate the command history list directly. If no parameters are entered, HISTORY will display the current command history list.

 

With the options explained below, you can clear the list, add new commands to the list without executing them, save the list in a file, or read a new list from a file.

 

The number of commands saved in the history list depends on the length of each command line. The history list size can be specified at startup from 4,000 to 500,000 characters (see the Command History Buffer Size configuration option). The default size is 20,000 characters.

 

Your history list can be stored locally (a separate history list for each copy of TCC) and/or globally (all copies of TCC share the same list). For full details see local and global history. When displaying, creating or deleting history entries, you can specify which list you want HISTORY to search with the /GL and /LL options.

 

NOTE: TCC as of version 26 supports simultaneous local and global command history lists. This is for advanced users only; it is not generally recommended to have both types. If you have only a local command history list or only a global command history list, history recall will work the same as in previous versions. If you have both local and global command history lists, searching backwards through the history will first search the local list. If you reach the beginning of the local list, the next history entry returned will be from the end of the global list. If you search forwards through the global list, when you reach the end the next history entry returned will be the beginning of the local list. If you try to go beyond the beginning of the global list or the end of the local list TCC will beep. Note that history wrapping is not compatible with local + global lists.

 

When searching the history, TCC will look first in the local list (if it exists), and then in the global list (if it exists).

 

If you use the /G option to convert a local history list to a global history list, HISTORY will not do the conversion if a global history list already exists (for example, in another TCC session or in SHRALIAS).

 

You can use the HISTORY command as an aid in writing batch files by redirecting the HISTORY output to a file and then editing the file appropriately. However, it is easier to use the LOG /H command for this purpose.

 

You can disable the history list or specify a minimum command line length to save with the Minimum Length configuration option. You can prevent any command line from being saved in the history by beginning it with an "at" sign (@).

 

You can exclude specific commands from the History List with the HistoryExclude variable.

 

You can control whether duplicate entries will be saved in the history list with the Duplicates configuration option.

 

You can save the history list by redirecting the output of HISTORY to a file. This example saves the command history to a file called HISTFILE and reads it back again immediately. If you leave out the HISTORY /F command on the second line, the contents of the file will be appended to the current history list instead of replacing it:

 

history > histfile

history /f

history /r histfile

 

If you need to save your command history at the end of each day's work, you might use the first of these commands in your TCSTART.BTM or other startup file, and the second in TCEXIT.BTM:

 

if exist c:\histfile history /r c:\histfile

history > c:\histfile

 

This restores the previous history list if it exists, and saves the history when TCC exits.

 

TCC can also load and save the history list automatically if you use the History File configuration option.

 

Options:

 

/=Display the HISTORY command dialog to help you set the filename and command line options. The /= option can be anywhere on the line; additional options will set the appropriate fields in the command dialog.

 

/AAdd a command to the history list. This performs the same function as the Ctrl-K key at the command line.

 

/F["..."] Erase entries in the command history list. You can have multiple /F"..." arguments, and they can contain wildcards. If you don't include the optional quoted argument, /F will erase the entire list.

 

/GSwitch from a local to a global history list. If you already have a global history list (for example, in another TCC instance or in SHRALIAS), HISTORY will not do the conversion.

 

/GLRead from and write to the global history list. If you have both local and global history lists defined and do not specify /GL, HISTORY will default to using the local list.

 

/LSwitch from a global to a local history list.

 

/LLRead from and write to the local history list.

 

/MNumber the lines when displaying the history list.

 

/NRemoves duplicate entries (oldest first) from the history list.

 

/PWait for a key after displaying each page of the list. Your options at the prompt are explained in detail under Prompts.

 

/RnRead the command history from the specified file and append it to the history list currently held in memory.

 

If you are creating a HISTORY /R file by hand, and need to create an entry that spans multiple lines in the file, you can do so by terminating each line, except the last, with an escape character. However, you cannot use this method to exceed the command line length limit.

 

If you try to load a file that is larger than the history list size, HISTORY will only load the last part of the file that will fit.

 

You can optionally specify whether HISTORY should ignore duplicates and HistoryExclude and always append the lines by specifying /R1. (This will be considerably faster for large history lists.)

 

/TnDisplay the last n lines of the history. If n is negative, skip the first -n lines of the history.

 

/VDisplay the history in reverse order. This cannot be combined with /T.