Creating aliases in DOS/Command Prompt

Problem:

One of the features I wish for in the Command Prompt launched in Windows is the ability to create aliases. However, there is a way to accomplish the same.

Solution:

  1. You can create aliases in the Command Prompt by typing doskey {ALIAS}={VALUE}
    [For Example: doskey d=dir]
  2. Launch notepad and type some aliases. Note that $1 represents an argument. You can specify arguments from $1 to $9. For more info, check out the doskey documentation.
    doskey cd=cd /D $1
    doskey d=dir
    doskey mv=move
    doskey rm=del

  3. Save the file as C:\aliases.bat

  4. Create a shortcut on your desktop to cmd.exe (found in the system32 directory)

  5. Go to the Shortcut Properties -> Shortcut tab -> Target section
  6. Append /K C:\aliases.bat to the existing value

    Properties window for Shortcut to Command Prompt

    Properties window for Shortcut to Command Prompt

  7. Click OK to save the changes
  8. Double click the shortcut on the desktop and launch a new command window
  9. Try out some of your aliases (Example: d for dir)
     
Note: To accomplish the same functionality in a DOS window during boot time, modify the autoexec.bat file.
About these ads

2 Comments

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 )

Google+ photo

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

Connecting to %s