3

I am using Unix and Windows machines, and I want to make the Command prompt behave in a way similar to my Unix Teminals.

One of the things is the aliases that I am used to on Unix.

For example - I am used to

alias p 'ls -lt'; pwd;

How can I set this alias on Windows command prompt using dir command?

Lazer
  • 18,407

2 Answers2

7

You want to look at doskey, which is a command built in to cmd in Windows XP onwards (and was a DOS utility in previous versions).

Simple usage example: doskey dirw=dir /w

Now using dirw will instead call dir /w.

DMA57361
  • 18,793
0

.cmdrc, the most convenient unix-like experience

If you are looking for a bash-like experience, this is the closest you can get.

  • Loads automatically with every instance of cmd
  • Doesn't require keyword DOSKEY for aliases
    example: ls=ls --color=auto $*
  • Supports arbitrary commands (e.g. custom welcome prompt, etc.)

See this QA for details How to set an alias in Windows Command Line?

cmd greetings & aliases

Qwerty
  • 586