Friday, July 01, 2005

Customising your command shell

Taking care of automating common stuff is a very important way of ensuring that your fingers and mind last a little while longer in this IT field :)

Usually the first complaint that people the unix background will have when they use a windows machine is the command shell. The lack of aliases, .profile etc. Internal to MS there are many utils which make this possible, but recently I figured that there is something which does the same thing on any windows machine. All you have to do is

doskey /macrofile:macros.txt

where macros.txt contains your aliases (called as macros for some weird reason in the windows world ...) like
ep=e:\progs\editplus\eppie.exe $*
h=pushd e:\jars\hibernate
env=sysdm.cpl,3

Now the final missing link is automatically executing this everytime you start your shell. Luckily there is a hook for this too. You can specify a batch file to run on each invocation by setting the following registry key.

[HKLM\SOFTWARE\Microsoft\Command Processor]
"AutoRun"="e:\\progs\\tools\\init.bat"


Now the final missing link is sharing histories across command shells. I usually open many command shells during work and often I want to execute the same commands which I executed in the other shells and I am not aware of any way to do this in cmd (similar to shralias in 4nt). If you know to get this to work in cmd, I would be eternally grateful for that information :))

No comments: