Launch Windows Terminal with multiple tabs

First, I like Windows Terminal and it is only getting better. Second, I want to start it with multiple tabs. Here is how I did it.

First, I like Windows Terminal and it is only getting better. Second, I want to start it with multiple tabs. Here is how I did it.

At the time of writing this article the current version of Windows Terminal is 1.5.10411. This version of Windows Terminal does not have the code to launch multiple tabs cleanly. There are some hacks you can do like creating a shortcut that does it through command line arguments (linked at the bottom of this post), but that's lame, you loose the features it integrates into Windows.

The ability to do it through the settings.json, in my opinion, the better way, was added in version 1.6. Which currently is in the preview build. Luckily, you can get the preview version of the Windows Terminal app through the Microsoft Store.  Just look for Windows Terminal Preview.

After you get the preview version installed, launch it and get to the settings. Click the dropdown next to the + and select settings. It will open up in your editor. In here you can add new profiles and change a few other settings related to Terminal. The default settings file does not contain the needed JSON property automatically. You will need to add a new one with the name startupActions. The value should be something like this ; new-tab Debian. Yes, it starts with a semicolon then a space. You would replace Debian with the name of whatever shell you would like to open. To open more than a second one, just put in another ; new-tab ShellName. The list of shells and their names are in that same file under profiles/list.

Here's my entire settings.json file which opens the default PowerShell tab and 2 Debian tabs.

// This file was initially generated by Windows Terminal Preview 1.6.10412.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.

// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
    "startupActions": "; new-tab Debian ; new-tab Debian",

    "$schema": "https://aka.ms/terminal-profiles-schema",

    "defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",

    // You can add more global application settings here.
    // To learn more about global settings, visit https://aka.ms/terminal-global-settings

    // If enabled, selections are automatically copied to your clipboard.
    "copyOnSelect": false,

    // If enabled, formatted data is also copied to your clipboard
    "copyFormatting": false,

    // A profile specifies a command to execute paired with information about how it should look and feel.
    // Each one of them will appear in the 'New Tab' dropdown,
    //   and can be invoked from the commandline with `wt.exe -p xxx`
    // To learn more about profiles, visit https://aka.ms/terminal-profile-settings
    "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
            },
            {
                // Make changes here to the cmd.exe profile.
                "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                "name": "Command Prompt",
                "commandline": "cmd.exe",
                "hidden": false
            },
            {
                "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
                "hidden": false,
                "name": "PowerShell",
                "source": "Windows.Terminal.PowershellCore"
            },
            {
                "guid": "{58ad8b0c-3ef8-5f4d-bc6f-13e4c00f2530}",
                "hidden": false,
                "name": "Debian",
                "source": "Windows.Terminal.Wsl"
            },
            {
                "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
                "hidden": false,
                "name": "Azure Cloud Shell",
                "source": "Windows.Terminal.Azure"
            }
        ]
    },

    // Add custom color schemes to this array.
    // To learn more about color schemes, visit https://aka.ms/terminal-color-schemes
    "schemes": [],

    // Add custom actions and keybindings to this array.
    // To unbind a key combination from your defaults.json, set the command to "unbound".
    // To learn more about actions and keybindings, visit https://aka.ms/terminal-keybindings
    "actions":
    [
        // Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json.
        // These two lines additionally bind them to Ctrl+C and Ctrl+V.
        // To learn more about selection, visit https://aka.ms/terminal-selection
        { "command": {"action": "copy", "singleLine": false }, "keys": "ctrl+c" },
        { "command": "paste", "keys": "ctrl+v" },

        // Press Ctrl+Shift+F to open the search box
        { "command": "find", "keys": "ctrl+shift+f" },

        // Press Alt+Shift+D to open a new pane.
        // - "split": "auto" makes this pane open in the direction that provides the most surface area.
        // - "splitMode": "duplicate" makes the new pane use the focused pane's profile.
        // To learn more about panes, visit https://aka.ms/terminal-panes
        { "command": { "action": "splitPane", "split": "auto", "splitMode": "duplicate" }, "keys": "alt+shift+d" }
    ]
}

Links

Windows terminal: Predefined tabs on startup
Is it possible to start the Windows terminal with (multiple) tabs, each on a configured working directory? The reason for this is, because I usually manually do the same steps each day: Start the ...
Introduce startupActions in settings (#8770) · microsoft/terminal@3c044f2
Procedural solution for https://github.com/microsoft/terminal/issues/756. Introduces a `startupActions` global setting. This setting is as string with the same format as actions in command l...
microsoft/terminal
The new Windows Terminal and the original Windows console host, all in the same place! - microsoft/terminal
The file containing the settings schema. There's a LOT more options.