Published in Articles on by Michiel van Oosterhout ~ 3 min read
Windows Terminal is a modern host for command-line shells like Windows Command Processor and Windows PowerShell, and interactive command-line programs like ssh.exe
. The configuration of Windows Terminal can also be said to be modern: a simple and well-documented settings.json
file. This means we can automate the configuration using Windows PowerShell.

Profiles
Windows Terminal supports profiles. A profile is a combination of an interactive command-line program (typically a shell) and settings. Typically you'll have two profiles, one for Windows PowerShell (with GUID {61c54bbd-c2c6-5271-96e7-009a87ff44bf}
), and another one for Windows Command Processor (with GUID {0caa0dad-35be-5f56-a8ff-afceeeaa6101}
). And if you installed Git on Windows, then you may want to have another profile for Git Bash.
To help identify each profile, the Windows PowerShell script below extracts an icon from the command-line shell's executable (for Windows Command Processor and Windows PowerShell), or from its installation directory (for Git Bash), so that it can later be associated with its corresponding profile.
# Ensure the settings directory exists
$settingsDirectoryPath = "$Env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState"
if (-not (Test-Path -Path $settingsDirectoryPath))
{
$_ = New-Item -Force -ItemType Directory -Path $settingsDirectoryPath
}
# Ensure the settings file exists
$settingsFilePath = "$settingsDirectoryPath\settings.json"
if (-not (Test-Path -Path $settingsFilePath))
{
$_ = New-Item -Force -ItemType File -Path $settingsFilePath
}
# Save the profile icons
Add-Type -AssemblyName System.Drawing
$path = "$Env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe"
$icon = [System.Drawing.Icon]::ExtractAssociatedIcon($Path)
$icon.ToBitmap().Save("$settingsDirectoryPath\powershell.bmp")
$path = "$Env:SystemRoot\System32\cmd.exe"
$icon = [System.Drawing.Icon]::ExtractAssociatedIcon($Path)
$icon.ToBitmap().Save("$settingsDirectoryPath\cmd.bmp")
Settings
The Windows PowerShell script below defines an object representing the Windows Terminal settings, and saves it as a JSON file. The settings used in this script (e.g. $settings
) are for illustrative purposes only, adjust them as you see fit.
# Define settings
$settings = @{
confirmCloseAllTabs = $false
profiles = @{
defaults = @{
font = @{
face = "Cascadia Mono PL"
size = 9
}
cursorShape = "filledBox"
}
}
}
# Define the path to the settings
$settingsDirectoryPath = "$Env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState"
$settingsFilePath = "$settingsDirectoryPath\settings.json"
# Replace the settings.json file
$json = ConvertTo-Json $settings -Depth 5
Set-Content -Path $settingsFilePath -Value $json
Windows Terminal should be immediately updated with the new settings after you run this script. If you configured a color scheme that is the same as the color scheme you configured for Console Window Host in Configuring a Console Window Host color theme, then Windows Terminal's colors will be consistent with Console Window Host's colors.

Summary
Windows Terminal's configuration can be easily automated because it's just a JSON file, all of its settings are well-documented, and changes take effect immediately. With the right settings Windows Terminal can be made consistent with Console Window Host windows.