Windows – Command aliases in Command Prompt?

How can I make command aliases in Windows’ Command Prompt like I would with bash?

I found out about doskey in a forum thread, so I can do something like:

doskey ls=dir /b

…and now the command ls acts a little more like ls on Unix.  (I type ls so often in cmd, it isn’t even funny.)

But how do I get this to stick between sessions?  It goes away the next time I open cmd.exe.  (Is there something like .bash_profile?)

Solution:

cygwin can be used in this case although this is not exactly an on-topic answer.

http://www.cygwin.com/ CygWin
Download: http://cygwin.com/setup.exe

To access it easily in windows, you can put c:cygwinbin in your path.

note that there are a few command that clashes with windows software which is not equivalent e.g. find(1) vs find.exe — find(1) lists all files and subdirectories whereas find.exe functions like grep.

another option is to access

 

HKEY_LOCAL_MACHINESoftwareMicrosoftCommand ProcessorAutoRun  or  HKEY_CURRENT_USERSoftwareMicrosoftCommand ProcessorAutoRun

check out

 cmd.exe /? 

for more details