Customize Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorized as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

No cookies to display.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

No cookies to display.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

No cookies to display.

Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customized advertisements based on the pages you visited previously and to analyze the effectiveness of the ad campaigns.

No cookies to display.

In this article I will show you how to quickly install and configure Powerline to make your new Windows Terminal with PowerShell Core really cool 😎

⚠ WARNING: these steps have been tested for Windows 10 Insiders fast ring with PowerShell Core 7.1

Install Powerline

In this article I will use the project of Joel Bennett who did a great job developing Jaykul/PowerLine which, in my view, is the best, simplest to be customized and extended for PowerShell.

  1. Install dependencies:

    Install-Module PANSIES -AllowClobber
  2. Install powerline:

    Install-Module PowerLine

Set Powerline Fonts

For the dividers between segments, the powerline uses some unicode glyphs that must be present in the font used by the terminal.

⚠ WARNING: do not forget to select fonts that are compatible with these unicode glyphs on the settings.json

A very cool font that I have been using, that have powerline glyphs support, is the Cascadia Code from Microsoft, which is available on their Github for free and with open source license.

Search for the section thats define the settings for the commandline pwsh.exe and set the fontFace property to Cascadia Mono PL on Windows Terminal settings.json:

"profiles" : 
    [
        {
...
            "commandline" : "C:\\Program Files\\PowerShell\\7\\pwsh.exe",
...
            "fontFace" : "Cascadia Mono PL",
...

⚠ WARNING: do not copy and paste the above snippet into your settings.json! The lines with three dots mean that there is more json lines between it that I omitted. I am just giving you an example of what you should look for and modify in the file!

Create Profile

For start the powerline for each PowerShell Core session we need to create a profile Microsoft.PowerShell_profile.ps1 file on the folder %USERPROFILE%\Documents\PowerShell\ with the follow content:

Import-Module PowerLine
Set-PowerLinePrompt -PowerLineFont -SetCurrentDirectory -RestoreVirtualTerminal -Colors "#FFDD00", "#FF6600"

[System.Collections.Generic.List[ScriptBlock]]$Prompt = @(
    { "$env:USERNAME πŸ‘½" }
    { $executionContext.SessionState.Path.CurrentLocation }
    { '>' * ($nestedPromptLevel + 1) }
)

Now close the current tab from Windows Terminal or open a new PowerShell Core tab to see your new terminal with colors!

Extend and Customize

Each block from $Prompt will be a segment that you can code in PowerShell to extend the powerline functionality. Take a look at my other article where I made a script with some custom segments: Linux/Windows Terminal - Script to Display Random Emojis πŸ₯΄/🀬 from Commands that Return Errors