HOME
Stephen Knight
11/04/2011 02:46 PM
Adding unix like aliases to Windows CMD prompt

Type:

Batch/Command file

Category:

Firstly --> These scripts and entries are partly taken from the links below so not claiming they are all mine, though wish I had thought of using the alias doskey macro below!

This adds a new autorun entry so that when you open a command prompt it runs a batch file called macros.cmd. This is then used to run each time a doskey command to pickup a list of aliases stored in a file called doskey.mac in your user profile directory (or of course you can change all the paths if you wish).

The doskey macros is a good way of making one short command run a longer one, or to add shortcuts for commands such as "ls" when people are prone to using the Unix shell type commands.

The alias command defined here as one of the doskey macros allow you to amend the aliases from the command prompt a follows:

Alias - shows aliases
alias SAVE -- records current aliases to doskey.mac file
alias LOAD -- load aliases back from file
alias anything else gets passed to doskey command line,

e.g.

alias ls=dir
alias lsl=dir /w
alias SAVE

See code area below for the changes to make:

Show details for CodeCode
Hide details for ExplanationExplanation
Show details for ExamplesExamples
Hide details for AttachmentsAttachments