Add PowerShell 7-preview to Windows Terminal in 2 minutes

Edit: The stuff below doesn’t work any more. But this new stuff works.

The new Windows Terminal app is now available from the Microsoft Store, and the world is excited.

Here’s a quick ‘n dirty method to link it to PowerShell 7:

  1. Prerequisites: Windows Terminal app & PowerShell 7 x64.
  2. Run Windows Terminal and open its Settings.
  3. A file in your local AppData called profiles.json will open. Paste the stuff below into the profiles section.
  4. Download the PowerShell .ico file and put it somewhere convenient. Amend the icon path if necessary.
{
    "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" : "{4f91b7ed-8cd4-4b20-ba02-429fcebd800a}",
    "historySize" : 9001,
    "icon" : "C:\\Git\\PowerShell\\pwsh_32512.ico", 
    "name" : "PowerShell 7-preview",
    "padding" : "0, 0, 0, 0",
    "snapOnInput" : true,
    "startingDirectory" : "%USERPROFILE%",
    "useAcrylic" : false
},

Notes:

  • Windows Terminal will accept icon files in .png and .ico format.
  • But it won’t read the icon from an .exe.
  • Variable expansion does not seem to work in the icon path (so no %APPDATA%… – it stops Windows Terminal from running entirely!)
  • I also show a couple of ways to detect that Windows Terminal is in use: the existence of an environment variable called WT_SESSION and the path of the process’ parent. Does anyone have anything else?

Leave a Reply

Your email address will not be published. Required fields are marked *