How To Add PowerShell v7 Preview to the New Windows Terminal

In this quick post I’ll show you how to add PowerShell v7 preview 1 to the new Windows Terminal.

Background

The new Windows Terminal was announced at Build this year and has been available (building from source code yourself) through the Microsoft/Terminal GitHub repo.  A very early preview of the Windows Terminal is now available through the Microsoft Store (link).  I haven’t verified but I believe you’ll need a few prerequisites in order to install.  Out of the box the current preview of Windows Terminal offers:

  • PowerShell Core (v6)
  • Windows PowerShell (v5)
  • CMD (command prompt)
  • WSL (Windows Sub-system for Linux, legacy console)

Solution

After installing the Windows Terminal from the Microsoft Store, open the Settings from the dropdown menu (or click “Ctrl + ,”).

Find the “profiles” element in the settings file and add the following JSON snippet to the array.  Verify the “commandline” and “icon” locations match where PowerShell v7 preview 1 is installed on your machine.

{
"acrylicOpacity" : 0.5,
"closeOnExit" : true,
"colorScheme" : "Campbell",
"commandline" : "C:\\Program Files\\PowerShell\\7-preview\\pwsh.exe",
"cursorColor" : "#FFFFFF",
"cursorShape" : "bar",
"fontFace" : "Consolas",
"fontSize" : 10,
"guid" : "{90cbdc15-f4fe-49d2-a245-ec066b70845f}",
"historySize" : 9001,
"icon" : "C:\\Program Files\\PowerShell\\7-preview\\assets\\Powershell_av_colors.ico",
"name" : "PowerShell 7 preview",
"padding" : "0, 0, 0, 0",
"snapOnInput" : true,
"startingDirectory" : "%USERPROFILE%",
"useAcrylic" : false
}

Here is a link to my complete profiles.json for comparison.

After you’ve added the above element you’ll now see PowerShell v7 Preview in your dropdown list of available shells with the proper icon.  For an added bonus I also added Zsh (with the Oh My Zsh framework for auto-suggestions and more) based on seeing demos from Jeff Hollan showcasing that shell.

WT PS v7 preview-1

Below screenshot shows PowerShell v7 Preview in use and verifying the PSVersion.

WT PS v7 preview-2

Conclusion

I’m very excited to begin using the Windows Terminal more in my daily tasks.  Being able to switch back and forth between multiple shells (specifically PowerShell v5 and v6/v7) is possible in Visual Studio Code but this will be a much easier solution for many of my scenarios.  Hopefully someone else will find this helpful as well.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s