Install the new Windows Terminal.
Get it from https://github.com/PowerShell/PowerShell/releases/latest . Visual Studio still uses the old PowerShell by default. What you want is PowerShell 7 or greater. This used to be known as PowerShell Core. It's cross-platform, open source, and just better.
In order to locate your VS install, grab the VSSetup
PowerShell module with Install-Module VSSetup -Scope CurrentUser
. Next, from a PowerShell terminal, open $PROFILE
in your favorite editor to start improving it.
You can then use the Enter-Vs
function in my sample $PROFILE
to put yourself in a VS dev environment. This takes a couple of seconds, so I only run it when I need it. But if you prefer to always have VS command line tools ready, just add a call to Enter-Vs
at the end of your $PROFILE
.
If you're used to unix shells, you may also consider installing PSReadLine
and adding the following to your profile:
Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward
Set-PSReadlineKeyHandler -Key Tab -Function Complete
You can install PSReadLine
like so:
Install-Module -Name PSReadLine -AllowPrerelease -Scope CurrentUser -Force -SkipPublisherCheck
Make stuff prettier if you like following instructions from https://www.hanselman.com/blog/HowToMakeAPrettyPromptInWindowsTerminalWithPowerlineNerdFontsCascadiaCodeWSLAndOhmyposh.aspx
I've attached my PowerShell profile and Windows Terminal settings files for reference.