Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Command Window

What is the usefulness of the Command Window in Visual Studio (menu View -> Other Windows -> Command Window)?

I know that the Visual Studio Command Window is used to execute commands or aliases directly in the IDE. The MSDN article Command Window explains how one can use the command window to print debug statements, but I feel that these can be easier executed in the Immediate Window.

What is the Command Window for?

like image 321
Kane Avatar asked Oct 12 '09 22:10

Kane


People also ask

How do I get the Command Window in Visual Studio?

The Command window is used to execute commands or aliases directly in the Visual Studio integrated development environment (IDE). You can execute both menu commands and commands that do not appear on any menu. To display the Command window, choose Other Windows from the View menu, and select Command Window.

How do I open a visual command prompt?

To open the terminal: Use the Ctrl+` keyboard shortcut with the backtick character. Use the View > Terminal menu command. From the Command Palette (Ctrl+Shift+P), use the View: Toggle Terminal command.

How do I open a Command Window?

The quickest way to open a Command Prompt window is through the Power User Menu, which you can access by right-clicking the Windows icon in the bottom-left corner of your screen, or with the keyboard shortcut Windows Key + X. It'll appear in the menu twice: Command Prompt and Command Prompt (Admin).

How do I open the Command Window in Visual Studio 2015?

3 Answers. Show activity on this post. I think that you might be using the wrong command window (The one in Visual Studio available by going to View -> Other Windows -> Command Window). The one you should be using the is the "Developer Command Prompt For VS2015" available as a shortcut in the Start Menu.


2 Answers

The Immediate window is mostly used for debugging, variable evaluation, etc. You sound familiar with it, so I won't belabor its usage. For more information on it, check out the MSDN article Immediate Window.

The Command window allows you to execute a variety of commands using their aliases. You'll notice that the command window prompt has a > character. You can open a file in your solution using of Class1.cs, hit enter, and open it up. In the Find dialog and Immediate window you would need to include the >, making it >of Class1.cs.

Nonetheless, you can do exactly the same thing in the Immediate window by prefixing a command with > as well. The Command window saves you an extra keystroke and is ready to go whenever you drop a command alias.

Check out these links for some commands:

  • Predefined Visual Studio Command Aliases
  • Immediate Window Commands

For example, to open the Quick Watch window, type ?? in the command window. Try that in the Immediate window and you'll get:

??
Invalid expression term '?'

Type >?? in the Immediate window, and it'll work.

like image 80
Ahmad Mageed Avatar answered Oct 05 '22 17:10

Ahmad Mageed


The Command Window offers a command-prompt style interaction with the IDE which some people seem to like, but all of the functions can be reached by shortcut keys, making typing out the command unnecessarily slow.

The "of", "open", or "File.OpenFile" command, for instance, is probably equivalent to navigating to the Solution Explorer ("CTRL+Tab" and arrow around, or one of the shortcuts for Solution Explorer "CTRL+W, S", "CTRL+ALT+L", or another of your creation), then typing the name of the file you want. The Solution Explorer will select the file as you type, press enter when you get to the right file.

Adding references can be done quickly by selecting the correct project in the solution explorer and pressing "Alt,P,R" (Just don't hit CTRL+Tab here because then VS will scour the registry for all the com components, use CTRL+SHIFT+Tab!). Adding a new code file is similar: "Alt,P,W, 'code', ". The menu system in Visual Studio is very well thought out. Using alt to get around it is very efficient, and beats the Command Window.

I currently use the command window (CTRL+Shift+C) to "closeall", "File.CloseAllButThis", and "open". I had high hopes for the Command Window when I first learned of its existence. I think I was basically looking for VIM, but don't expect too much from it, especially if you don't mind using shortcut keys for Find and other commands.

like image 26
lmat - Reinstate Monica Avatar answered Oct 05 '22 16:10

lmat - Reinstate Monica