Update: the Windows Terminal now automatically detects PowerShell Core and this blog post is defunct.

The new Windows Terminal continues to be developed and it has a dwindling list of deal-breakers (why won’t my mousewheel scroll??)

Along the way, the format of the settings file has changed, and my previous method for adding a profile for PowerShell 7 no longer works.

Below is a new block of code that’ll do the job. As before, just copy-n-paste into a PowerShell window and you’re good to go.

PowerShell 7-preview x64 needs to be installed and you need to have run Windows Terminal at least once.

I’m now doing horrible things with strings – because it’s easier than dealing with a comments and a JSON object – so this code is officially 3x more likely to blow up.

# Get Windows Terminal settings $terminalFolderPath = "$env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState" $settingsFilePath = Join-Path $terminalFolderPath 'profiles.json' [System.Collections.ArrayList]$settings = Get-Content $settingsFilePath # Download icon $pwsh7IconPath = Join-Path $terminalFolderPath 'pwsh7.ico' Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/weebsnore/Add-PS7ToWindowsTerminal/master/pwsh7.ico' -OutFile $pwsh7IconPath # Generate PS7 profile JSON $ps7profile = @{ 'guid' = '{' + (New-Guid).ToString() + '}' 'name' = 'PowerShell 7-preview (x64)' 'commandline' = 'C:\Program Files\PowerShell\7-preview\pwsh.exe' 'icon' = $pwsh7IconPath } | ConvertTo-Json # Append comma to profile JSON $ps7profile = $ps7profile + ',' # Find "profiles" line number $profilesLine = ($settings | Select-String '"profiles":').LineNumber # Add new profile to JSON and write to disk ,$settings.Insert($profilesLine+1,$ps7profile) $settings | Out-File $settingsFilePath

Code here on GitHub.