Launch Windows Terminal in Visual Studio

Modern development has seen a resurgence of command-line tools. On a daily basis, I use Git CLI, .NET CLI, Azure CLI, and GitHub CLI (to name a few). All developers should learn to embrace the CLI, not only to improve their productivity but also to gain access to better and more powerful tools.

Figure: Windows Terminal + PowerShell – Running EF Core CLI

The quickest and most productive way to open Windows Terminal in Visual Studio is to use the Open Command Line extension. In this post, I’ll provide a quick overview and some advice on configuring the extension, and then I’ll share some resources so you can learn more. Let’s get started!

Open Command Line Extension

The Open Command Line (32-bit) extension by Mads Kristensen is the quickest way to open a new console in Visual Studio. Once installed, the extension can be invoked by right-clicking on a node in Solution Explorer or using the keyboard shortcut Alt + Space. To open a new console at the solution level, select the solution node in Solution Explorer and hit Alt + Space. For the project level, select the project and hit Alt + Space. For the folder level, well I think you see where I am going. This extension is the quickest way to open a new console at any level in your Visual Studio solution.

If you have Windows PowerToys installed, this keyboard shortcut may conflict with PowerToys Run. I recommend changing the PowerToys Run shortcut to ⊞ Win + Space.

The extension supports all consoles including Windows Terminal, PowerShell, cmder, bash, and more. Within Visual Studio, configure the extension by clicking Tools > Options and then selecting Environment > Command Line:

Figure: Open Command Line Options

The above options have been configured for Windows Terminal by selecting the relevant preset. However, using these presets can result in an error when launching at the project or folder level. When I try, I receive an error that the starting directory could not be accessed. For example:

Figure: Open Command Line Error Launching Windows Terminal

This is not necessarily an issue with Open Command Line, more like a problem with my Windows Terminal configuration. I work around this issue by configuring the extension as follows:

Figure: Open Command Line Options for Windows Terminal Issue

In the image above, Open Command Line has been configured as follows:

SettingValue
Select presetCustom
Commandwt
Command arguments-d %folder%

Using this configuration, Windows Terminal launches successfully at the correct starting directory.

Next Steps

In this post, I have demonstrated the quickest and most productive way to launch Windows Terminal in Visual Studio. If you would like to learn more, take a look at some of the following resources:

Thanks for reading, please feel free to post any questions or comments below.