简体   繁体   English

使用Visual Studio中的命令行

[英]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 (eg git stash , npm install , etc.) in the current project's working directory. 我想在Visual Studio中有一个工具窗口,允许我在当前项目的工作目录中键入命令行内容(例如git stashnpm install等)。 Something like this in Eclipse . 在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. 我尝试浏览Visual Studio库,但也没有骰子。 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. PowerShell可能也会起作用,因为据我所知,它是常规shell的超集。

In Visual Studio 11, the NuGet Package Manager Console is a fully featured PowerShell console. 在Visual Studio 11中,NuGet包管理器控制台是一个功能齐全的PowerShell控制台。 You can do all kinds of things there, including file system operations, git/hg/svn/tfs commands, etc. 你可以在那里做各种各样的事情,包括文件系统操作,git / hg / svn / tfs命令等。

You also can customize the experience with a special PowerShell profile called NuGet_profile.ps1. 您还可以使用名为NuGet_profile.ps1的特殊PowerShell配置文件自定义体验。

Installing the NuGet VSIX from the Visual Studio gallery will get you a similar experience in VS2010 if I'm not mistaken. 如果我没有弄错的话,从Visual Studio库中安装NuGet VSIX会在VS2010中获得类似的体验。

There is a command window in Visual Studio (CTRL + ALT + A) or (View -> OtherWindows -> Command Window) Visual Studio中有一个命令窗口(CTRL + ALT + A)或(View - > OtherWindows - > Command Window)

You can then use the shell command to run external executables 然后,您可以使用shell命令运行外部可执行文件

The syntax is: 语法是:

shell [/command] [/output] [/dir:folder] path [args]

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. 对于遇到这2018+的人,现在也捶捶终端从微软的扩展丹尼尔·格里芬 (@dgriffen在GitHub上),它给你正是你所期待的。

Whack Whack Terminal is a terminal emulator for Visual Studio 2017. Unlike other terminals for VS, Whack Whack Terminal is fully interactive. Whack Whack Terminal是Visual Studio 2017的终端模拟器。与VS的其他终端不同,Whack Whack终端是完全互动的。 Users can launch interactive git commits, vim, or almost any other command line utility. 用户可以启动交互式git提交,vim或几乎任何其他命令行实用程序。

The default terminal is powershell and it can be opened with the shortcut chord "Ctrl+\\, Ctrl+\\". 默认终端是powershell,可以使用快捷键“Ctrl + \\,Ctrl + \\”打开它。

CMD and WSLBash are also available terminal choices. CMD和WSLBash也是终端选择。

It's also open source! 它也是开源的! You can find the source code at Microsoft/WhackWhackTerminal on GitHub. 您可以在GitHub上找到Microsoft / WhackWhackTerminal的源代码。

您可以从Visual Studio扩展库下载PowerConsole

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM