Wednesday, March 30, 2011

Windows CMD .bashrc equivilant

This is the best thing ever! I could never find a way to automatically source a file no matter where/how I started "cmd" from Windows.

But here it is:


Bottom line:
  1. Create some file like: C:\Windows\cmdauto.cmd
  2. Add some stuff, like: doskey cp=copy $*
  3. Add a String Value "AutoRun" to this key:
    [HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
  4. Put "C:\Windows\cmdauto.cmd" as the value.
Now, no matter where you start cmd, it will execute "cmdauto.cmd" first.