With the announcement of PowerShell 7 Preview 5 being released yesterday, I decided I needed to download this preview version and check it out. At the same time, I recently listened to the Azure DevOps Podcast episode where Kayla Cinnamon and Rich Turner from Microsoft explained how the new Windows Terminal came to be. While exploring Windows Terminal, I really like the tab feature and being able to have multiple types of windows open that have different functionality. Armed with these two new tools, I set out to add a profile that launched the preview version of PowerShell 7 and this blog will walk through how to add it yourself.
First, in the Windows Terminal window, select the down caret to expose the currently available profiles, then select Settings.
There are quite a few things to customize here but I will be working under the profiles section. In the profiles section there will be the existing profiles for the applications already available, such as Windows PowerShell, cmd, Azure Cloud Shell, and PowerShell Core. I’m going to add a new section with some core information such as:
- guid: insert a random guid here to identify the new profile (hint: use New-Guid in PowerShell to generate one)
- hidden: boolean value that sets the visibility of the profile in Windows Terminal
- name: The name that will appear on the tab in Windows Terminal
- commandline: This is the path of the executable to launch when opening the tab; if inputting a full path, it requires escaping slashes with another slash (see screenshot below)
- icon: path to an image that will appear as the icon for the tab
I installed PowerShell 7 Preview 5 into “C:\Program Files (x86)\PowerShell”, so if you have installed it somewhere else, you’ll need to update your settings accordingly. The install location also has handy icon file (.ico) located in the “assets” folder in the installation directory.
Here is what my new profile looks like:
After saving the profiles.json file, Windows Terminal will auto refresh with the new settings, so no need to restart the application (this is awesome by the way). If there is an error in the json file, Windows Terminal will show an error window and give the line number where the problem is (also very useful). Now when selecting the menu a new profile will appear with the name specified in the profile as well as the icon:
Selecting the new profile will load the executable listed on our commandline option in the profile, and just to prove it has loaded PowerShell 7, I ran $PSVersionTable to show the PS version:
When the next preview version of PowerShell 7 comes out (and the GA version after that), I can install the new version and update my profile to point to the new executable along with changing the name and icon location. Or just create another profile that points to the new version and have multiple profiles available for each version.
Editing Windows Terminal JSON Settings