Equivalent of bash / shell aliases for Windows command line

Relief comes from an unexpected quarter if you pine for your unix command line shell aliases and other such:

doskey ls=dir $*

is what you want. you can put it in an autorun setting in your registry by pasting this into notepad and saving it as something.reg

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
"AutoRun"="\"C:\\Program Files\\Commands\\CmdAutoRun.cmd\""

If you prefer to do it by hand rather than by double clicking a .reg file, you don’t need the extra quotes and escapes (but keep the outermost quotes):

"C:\Program Files\Commands\CmdAutoRun.cmd"

Note you use $* instead of %*. You can otherwise use $1-$9. Further escape codes are on the technet DosKey page

2 thoughts on “Equivalent of bash / shell aliases for Windows command line

  1. Everett

    If you want something like bash then you should look at PowerShell. I was hesitant at 1st myself. But once I learned you can add your own alias (just as you would with a bash profile) I was sold. Now that I have used it for a few months I feel that it actually may be as good as bash.


Leave a Reply

Your email address will not be published. Required fields are marked *