TCC Command Aliases

TCC Command Aliases

The first and most common type of alias is the command alias. A command alias is simply a command which you define, and which is expanded by TCC into some other command or series of commands. If you're familiar with the macro facility of Microsoft's DOSKEY program, you will find command aliases similar but more powerful. One major difference is that, unlike DOSKEY macros, command aliases can be used in batch files as well as at the prompt.

Most command aliases serve one of four purposes: to abbreviate a longer command (or series of commands), to supply default options to a command, to substitute one command for another, or just to provide a more mnemonic name for a command. An abbreviation can make a long command as short as you like, down to a single letter:

You can use a command alias to supply default options to a command. For example, if you usually want DIR to include hidden and system files, you could create an alias to add the /A option automatically:

alias dir=*dir /a

Be careful with this kind of alias! Aliases are active in batch files as well as at the command prompt; changing the behavior of common commands like DIR can sometimes have unforeseen consequences in batch files or even in other aliases. It might be safer to create an alias with a different name:

alias da=dir /a

You can also use a command alias to substitute one command for another. If you are in the habit of typing one command name, you can substitute a different command without having to retrain your fingers: