Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using the command line from within Visual Studio

I'd like to have a tool window in Visual Studio that allows me to type command line things (e.g. git stash, npm install, etc.) in the current project's working directory. Something like this in Eclipse.

I can't find any such option in any of the menus, but admittedly they're labyrinthine. I tried looking through the Visual Studio gallery, but no dice either. Any extension or hidden option that would give me this?

PowerShell would probably also work, as from what I understand that's a superset of the regular shell.

like image 429
Domenic Avatar asked Mar 22 '12 17:03

Domenic


People also ask

How do I add command-line options in Visual Studio?

To set command-line arguments in Visual Studio, right click on the project name, then go to Properties. In the Properties Pane, go to "Debugging", and in this pane is a line for "Command-line arguments." Add the values you would like to use on this line. They will be passed to the program via the argv array.

How do I open a Visual Studio project from the command-line?

start MySolution/MySolution. sln and hit Enter . This will open whatever version of Visual Studio you currently have set to open with . sln files in Windows.


4 Answers

In Visual Studio 11, the NuGet Package Manager Console is a fully featured PowerShell console. You can do all kinds of things there, including file system operations, git/hg/svn/tfs commands, etc.

You also can customize the experience with a special PowerShell profile called NuGet_profile.ps1.

Installing the NuGet VSIX from the Visual Studio gallery will get you a similar experience in VS2010 if I'm not mistaken.

like image 158
Peter Provost Avatar answered Oct 26 '22 20:10

Peter Provost


For anyone that comes across this in 2018+, there is now also the Whack Whack Terminal extension from Microsoft's Daniel Griffen (@dgriffen on GitHub), which gives you exactly what you were looking for.

Whack Whack Terminal is a terminal emulator for Visual Studio 2017. Unlike other terminals for VS, Whack Whack Terminal is fully interactive. Users can launch interactive git commits, vim, or almost any other command line utility.

The default terminal is powershell and it can be opened with the shortcut chord "Ctrl+\, Ctrl+\".

CMD and WSLBash are also available terminal choices.

It's also open source! You can find the source code at Microsoft/WhackWhackTerminal on GitHub.

like image 28
Yann Duran Avatar answered Oct 26 '22 18:10

Yann Duran


There is a command window in Visual Studio (CTRL + ALT + A) or (View -> OtherWindows -> Command Window)

You can then use the shell command to run external executables

The syntax is:

shell [/command] [/output] [/dir:folder] path [args]
like image 36
dmck Avatar answered Oct 26 '22 20:10

dmck


You can download PowerConsole from the Visual Studio extensions gallery.

like image 41
Keith Hill Avatar answered Oct 26 '22 20:10

Keith Hill