Export (0) Print
Expand All

Visual Studio Commands

Visual Studio .NET commands allow direct interaction with the integrated development environment (IDE) from the keyboard. Dialog boxes, windows, and other items within the IDE have a command equivalent that you can type into the Command window or Find/Command box to display and, in some cases, execute the item. The set of available commands includes all commands listed in the Keyboard pane under the Environment options in the Options dialog box, as well as user-defined aliases and macros. Visual Studio commands follow certain general syntax rules, which are explained below. For detailed information about command syntax, see Visual Studio Commands with Arguments.

Visual Studio command syntax

Visual Studio commands can be entered in both the Find/Command box and the Command window. In each case, the greater than sign (>) is used to indicate that a command rather than a search or debug operation is to follow.

Commands can appear in two formats, the complete command syntax and an alias of the full syntax.

Complete command names

The complete syntax for commands is based on the full command name listed on the Keyboard pane under the Environment options in the Options dialog box. In most cases, the complete syntax reflects the placement of commands in the IDE menu system. Complete command names adhere to the following syntax rules.

  • Command categories, such as menus, and command names are separated by a period (.).
  • Spaces and punctuation are removed from all command names as displayed on the menus.

For example, the New File dialog box command appears in the File command category as New File on the Keyboard pane. To display this dialog box, you type the following command syntax into the Command window or Find/Command box and press ENTER.

>File.NewFile

The New File dialog box appears, ready for you to make your selection.

Command aliases

You can create short names, or aliases, for complete command names to help you remember and enter the commands more quickly. Visual Studio comes with a set of pre-defined aliases. For example, the New File dialog box has by default the alias nf. For more information, see Pre-defined Visual Studio Command Aliases.

You can create your own custom aliases or change pre-defined aliases by using the Alias command. For example, you can create an alias for the command Edit.MakeUpperCase by entering the following:

>alias upper Edit.MakeUpperCase

The next time you select text in the editor and enter >upper in the Find/Command box or Command window, the text will appear in all capitals. You can also create aliases that include command names and their arguments.

You can display the list of current aliases by entering the following command in the Command window:

>alias

Commands with arguments

Some commands allow you to provide arguments, such as file names or switches that execute a command, without displaying any dialog boxes or other user interfaces. For example, File.NewFile, displays the New File dialog box. You can, however, create a new file without displaying the New File dialog box at all, as shown in this example:

>File.NewFile mytext /t:"General\Text File"

This syntax creates a new text file, called Mytext.txt, based on the text file template.

Note   Arguments must be placed in the order given for the command, but switches can be placed in any order.

Commands and arguments adhere to the following syntax:

  • Command names and arguments are separated by spaces
  • Argument values that contain spaces must be enclosed in quotation marks
  • Use the caret (^) character for escape characters
  • Single-character argument abbreviations can be combined. For example, you can combine the single character argument abbreviations for /case (/c) and /word (/w) as /cw instead of /c /w.

Some command name switches have full and short names that can be used interchangeably. For example, the Edit.Find command has the /case switch, which can also be referred to as /c. For a complete list, see Visual Studio Commands with Arguments.

Escape Characters

A caret (^) character in a command line means that the character immediately following it is interpreted literally, rather than as a control character. This can be used to embed straight quotation marks ("), spaces, leading slashes, carets, or any other literal characters in a parameter or switch value, with the exception of switch names. For example,

>Edit.Find ^^t /regex

A caret functions the same whether it is inside or outside quotation marks. If a caret is the last character on the line, it is ignored.

Auto completion for commands

Both the Find/Command box and the Command window provide auto completion when you enter command names and aliases. The auto completion list displays all possible matching command names and aliases, whether or not the command is currently available. If you enter or select an unavailable command, the status bar displays the message, "The command is not available" and the command is ignored.

International command names

In localized versions of the Visual Studio .NET IDE, command names can be entered either in the native language of the IDE or in English. For example, you can type either File.NewFile or Fichier.NouveauFichier in the French IDE to execute the same command.

Macro names are similar to command names. Although you can save macros using a localized name, for better compatibility between English and localized versions of Visual Studio .NET, it is best to save macros using English names. This is because all localized versions of the IDE understand English commands, but not all localized versions of the IDE understand a different localized language.

The Microsoft Knowledgebase article, List of Localized Visual Studio .NET Command Names (Q306611) provides a list of all localized Visual Studio .NET commands and their English equivalents.

See Also

Pre-defined Visual Studio Command Aliases | Visual Studio Commands with Arguments | Command Window | Find/Command Box

Show:
© 2014 Microsoft