Share via


Understanding Commands: Aliases

Keyboard:  CTRL + ALT + A
Menu:  View -> Other Windows -> Command Window
Command:  View.CommandWindow
Versions:  2008,2010
Published:  8/9/2010
Code:  vstipTool0068

 

Using an Alias

When using commands it is cumbersome to type in the full command sometimes.  You can use command aliases to quickly use a command without having to type in the full command syntax.  If you want a list of the current aliases just open the Command window (CTRL + ALT + A) and type "alias":

image

 

By the way, you can clear the Command window out at anytime by typing "cls" just in case you were wondering.  Let's take a simple alias as an example for our use.  How about the "Debug.ToggleBreakpoint" command?  Notice the alias is "bp".  Let's find a line of code:

image

 

Now we can go to the Command window and type "bp":

image

 

It put's a breakpoint on the line:

image

 

 

 

Create a New Alias

In addition to the alias that are already there, you can create new ones.  Let's create one for the "Project.AddClass" command.  Simply type "alias [alias to use] [command]".  In our case, Let's put in "alias ac Project.AddClass":

image

 

Anytime we want to add a class we can type the command alias "ac" and get the Add New Item dialog:

image

 

 

 

Viewing Assigned Aliases

To show what command an alias is assigned to just type "alias [alias]".  So, in this case, I would put in "alias ac" to see what command "ac" is bound to:

image

 

 

 

Delete an Alias

To get rid of an alias type "alias [alias] /d[elete]".  To get rid of the alias we just made we would type "alias ac /d":

image

 

You can confirm the alias is gone by typing "alias ac":

image