Doskey: creating aliases under Windows command prompt

June 30, 2010 at 6:02 pm 1 comment

I’m tired of typing “ls” on an Windows command prompt and getting bounced back with an error. Aliases are truly a necessity. To simulate the behavior of “alias” on Windows, do the following:

1. Create a shortcut for cmd.exe, right-click on the shortcut and choose “properties” and proceed as follows.

2. Change the “start in” directory to your personal choice, such as “%HOMEDRIVE%%HOMEPATH%”

3. Create a batch file, such as “set_alias.bat”, in the “start in” directory. The file should contain the doskey command that loads the alias definitions. A sample file would contain this line:

doskey /MACROFILE=aliases.txt

4. Edit all your aliases.txt file, or other files that contain the Macros. For example, aliases.txt could look like this:

ls=dir $*
cp=copy $*
python2=C:\Python26\python26.exe $*
python3=C:\Python31\python31.exe $*

$* allows you to take an arbitrary number of arguments and pass that to the program (up to 9?)

5. At the end of “Target” line in the shortcut properties, add your batch script with “/K” option to run upon launching. The Target line should look similar to this:

C:\Windows\System32\cmd.exe /K set_alias.bat

Done! Now cruise along :)

Advertisement

Entry filed under: All, Tools. Tags: .

CUDA new features (well, kinda new) Programming Python with bpython – now THAT is neat!

1 Comment Add your own

  • 1. zac  |  August 1, 2010 at 10:14 am

    You could also install the Interix subsystem for Windows. It has native unix utils for Windows

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


Calendar

June 2010
M T W T F S S
« Apr   Jul »
 123456
78910111213
14151617181920
21222324252627
282930  

Most Recent Posts


Follow

Get every new post delivered to your Inbox.