Fine-Tuning Windows Terminal

by Nov 10, 2020

In the previous tips we explained how you can install „Windows Terminal“ on Windows 10 via the Microsoft Store. Windows Terminal features PowerShell consoles in separate tabs and is very useful.

You can control the types of consoles available in the tab drop-down list by editing the settings file: in Windows Terminal, in the title bar click the down arrow button, and choose „Settings“. This opens a JSON file in your associated editor. If no editor is associated with JSON files, you can pick one or revert to Notepad.

The „profiles“ section lists the console types you can open in Windows Terminal using the „down arrow“ button. Here is an example:

 
"profiles":
    {
        "defaults":
        {
            // Put settings here that you want to apply to all profiles.
        },
        "list":
        [
            {
                // Make changes here to the powershell.exe profile.
                "guid""{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "name""Windows PowerShell",
                "commandline""powershell.exe",
                "hidden"false,
                "useAcrylic"true,
        "acrylicOpacity" : 0.8,
            },
            {
                // Make changes here to the cmd.exe profile.
                "guid""{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                "name""Command Shell",
                "commandline""cmd.exe",
                "hidden"false,
                "useAcrylic"true,
        "acrylicOpacity" : 0.8,
            },
            {
                "guid""{574e775e-4f2a-5b96-ac1e-a2962a402336}",
                "hidden"false,
                "name""PowerShell",
                "source""Windows.Terminal.PowershellCore",
                "useAcrylic"true,
        "acrylicOpacity" : 0.8,
            },
            {
                "guid""{2595cd9c-8f05-55ff-a1d4-93f3041ca67f}",
                "hidden"false,
                "name""PowerShell Preview (msix)",
                "source""Windows.Terminal.PowershellCore",
                "useAcrylic"true,
        "acrylicOpacity" : 0.8,
            },
            {
                "guid""{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
                "hidden"false,
                "name""Azure Cloud Shell",
                "source""Windows.Terminal.Azure",
                "useAcrylic"true,
        "acrylicOpacity" : 0.8,
            },
            {
                "guid""{0caa0dae-35be-5f56-a8ff-afceeeaa6101}",
                "name""Terminal As Admin",
                "commandline""powershell.exe -command start 'C:/wt/wt.exe' -verb runas",
                "icon""ms-appx:///Images/Square44x44Logo.targetsize-32.png",
                "hidden"false
            },
            {
                "guid""{0ca30dae-35be-5f56-a8ff-afceeeaa6101}",
                "name""ISE Editor",
                "commandline""powershell.exe -command powershell_ise",
                "icon""c:/wt/ise.ico",
                "hidden"false
            },
            {
                "guid""{b39ac7db-ace0-4165-b312-5f2dfbbe4e4d}",
                "name""VSCode",
                "commandline""cmd.exe /c \"%LOCALAPPDATA%/Programs/Microsoft VS Code/code.exe\"",
                "icon""c:/wt/vscode.ico",
                "hidden"false
            }
        ]
    }
 

As you see, you can define a path to any executable, and with options like „useAcrylic“ and „acrylicOpacity“ you can control transparency.

Take a look at the entries towards the end of the list: they illustrate how you can use the drop down menu to launch external programs like editors (VSCode, ISE), or even open Windows Terminal with Administrator privileges.

The trick is to launch external applications with either „cmd.exe /c“ or „powershell“. If you launch external applications directly, this would result in a blank tab window that remains open until the external application is closed again.

Note also how you can add your favorite icons to list entries: use „icon“ and submit a bitmap or ico file. In an upcoming tip we show how you can create such icon files via PowerShell code.

If you plan to add new entries to the list, keep in mind that each entry needs a unique GUID. In PowerShell, use New-Guid to create one.

Once you save the JSON file, the edits take effect immediately. If the JSON edits you made damage the file or introduce syntax errors (such as unbalanced quotes etc), Windows Terminal will complain. It is a good idea to make a backup copy before you edit, and use an editor like VSCode that supports JSON format and assist you by pointing you to syntax errors.


Twitter This Tip! ReTweet this Tip!