Show/Hide Toolbars

Take Command / TCC Help v. 21

Navigation: Tutorials

TCC Command Aliases

Scroll Prev Top Next More

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:


alias c=copy

alias d=dir

alias l=list

alias q=`pushd "c:\program files\quake iii arena" & quake3.exe & popd`

alias ff=firefox.exe

alias tf=dir /[d] /od


A command alias can be an abbreviation for multiple commands:


alias eval=`set eval=%@eval[%$] && echo [%$] = %@comma[%eval]`

alias nd=`md /s %1 && %1\`


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:


alias edit=notepad.exe

alias more=list

alias pkunzip=unzip.exe

alias telnet="c:\program files\secure telnet and ftp\sshclient.exe"


Finally, you can use a command alias to create a more memorable name for a command:


alias kill=taskend /f

alias shutdown=reboot /p

alias word=winword.exe