UNIX has a nice command named alias that lets you create a new command
from either one or more existing commands and parameters. For
instance you could alias "lpstat -t | pg" as "stat" and then you could
just type stat at the command line instead of the long ugly string each
time.
Windows (at least up to XP) does not have a mechanism for this.
Instead I use batch files to replicate the alias functionality. I
create a directory containing all my alias batch files and then add
this directory to the path like this:
from the command prompt type:
path = %PATH%;newdir
%PATH% is the environment variable that represents the
current path so this command allows you to append to the current
path.
So in my case I created a directory c:\work\cmd and then added it to
the path path = %PATH%;c:\work\cmd. Then I create the batch files
for each command I want to alias. For instance I use gvim so i
created a bat file with this text:
Start "GVIM" "C:\Program Files\vim\vim63\gvim.exe" %1 %2 %3 %4 %5 %6 %7 %8 %9
and saved it as vi.bat.
Start tells windows to open the program in a new
window. Otherwise your command line window will hang and wait for
the program you launched to exit, which is not the
behavior I want.
"GVIM" tells windows what the display name of the window is. Not necessary but I like it.
"C:\Program Files\vim\vim63\gvim.exe" is the full path the exe to run.
%1 through %9 is simply a way to pass through any
parameters on the command line (like file names) to the program you
are starting.
So now I can "vi" a file by typing "vi filename.txt" from the command line.
I like this technique because it is very portable between
machines. Just copy over one folder and then add one entry to the
path and you are set. Very handy for me since I regularly use 3
PC's and I'm always tinkering with new programs etc. It's not as
nice as alias but it works.