/
/

How to Enable or Disable “Do You Want to Close All Tabs” in Windows Terminal

How to Enable or Disable Do you want to close all tabs in Windows Terminal blog banner image

Windows Terminal lets you close all tabs at once, but disabling prompts in script-heavy environments can jeopardize other sessions. This guide outlines how to toggle these prompts, allowing you to customize the Terminal’s closing behavior to fit your needs. Additionally, we’ll walk you through key considerations, FAQ, and common issues encountered when making the change.

Methods to toggle “close all tabs” in Windows Terminal

Windows Terminal hosts various command-line shells, and its tabbed interface makes it easy to operate multiple command-line interface sessions. When closing multiple Terminal tabs, a confirmatory prompt appears to avoid accidental closures.

Say you’re done with all Terminal-related tasks; closing all tabs in one fell swoop is ideal. On the flipside, if you’re operating persistent background scripts, it’s best to enable confirmation prompts to avoid accidental session closures.

Regardless of your use case, it’s best to configure Terminal settings according to your needs to streamline your workflow. For a smooth configuration of Windows Terminal’s confirmation prompts, ensure that you meet the prerequisites below.

📌 Prerequisites:

  • Windows 11 device.
  • Windows Terminal access.
  • Updated Windows Terminal version.

📌 Recommended deployment strategies:

Click to Choose a Method💻

Best for Individual Users

💻💻💻

Best for Enterprises

Method 1: Toggle the close all tabs prompt via Windows Terminal settings
Method 2: Manage confirmation prompts via Terminal’s Settings .JSON file

Method 1: Toggle the close all tabs prompt via Windows Terminal settings

The easiest way to manage how the Windows Terminal closes is through its settings page. As long as you have Terminal access, managing its settings is always one click away.

📌 Use Case: This method is suitable for per-user configurations of the Terminal’s close all tabs confirmation dialog box.

  1. Press Win + X and select Terminal from the context menu.
  2. Click the drop-down menu beside Open a new tab and select Settings.

Windows Terminal settings

    • Alternatively, you can press Ctrl + , to open the Terminal’s Settings page.
  1. Select Interaction on the left pane, then find Warn when closing more than one tab.

Interaction option: Warn when closing more than one tab

  1. Change the switch beside Warn when closing more than one tab to match the confirmation dialog behavior you prefer:
    • On: Enables confirmatory prompt when closing multiple tabs.

Toggle on for Warn when closing more than one tab

    • Off: Disables confirmatory prompts when closing multiple tabs.

Toggle off for Warn when closing more than one tab

  1. Press Save to apply the change.

Save button to apply changes

💡 Tip: After pressing save, the change applies instantly for the current user.

Method 2: Manage confirmation prompts via Terminal’s Settings .JSON file

Although the Terminal’s Settings offers a quick way to manage confirmation prompts, it’s difficult and repetitive to deploy. Instead, administrators can modify the Terminal’s JSON settings file directly, enabling deployments for multiple user profiles.

⚠️ Warning: JSON misconfigurations can break Windows Terminal’s functionality. (See ⚠️ Things to look out for.)

📌 Use Cases: Administrators can directly edit the Terminal’s JSON file instead of configuring it via the Settings page. Additionally, this method serves as a starting point when managing the Windows Terminal’s close all tabs prompt for multiple users.

📌 Prerequisites: JSON file backup

  1. Press Win + X, then choose Windows Terminal.
  2. Click the drop-down menu beside Open a new tab, and select Settings.

Windows Terminal settings

  1. Press the Open JSON file button located in the bottom-left corner.

Open JSON file button

  1. Choose Notepad to open the JSON file when prompted.

Notepad app to open JSON file

  1. Locate the following key-value pair:

Key-Value pair

  1. Change the highlighted key-value pair above to modify Terminal’s exit behavior:
    • To enable confirmation prompts when closing all Terminal tabs:

"confirmCloseAllTabs":true,

    • To disable confirmation prompts when closing all Terminal tabs:

"confirmCloseAllTabs":false,

  1. Press Ctrl + S and restart Windows Terminal to apply the change.

💡 Tip: Optionally, you can automate this process by entering the following script on a PowerShell prompt:

  • Turn on confirmation dialogs when closing all tabs in Terminal:

$f="$env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json"; if(Test-Path $f){Copy-Item $f "$f.bak" -Force; ($j=Get-Content $f -Raw|ConvertFrom-Json).confirmCloseAllTabs=$true; $j|ConvertTo-Json -Depth 100|Set-Content $f -Encoding UTF8}

  • Turn off confirmation dialogs when closing all tabs in Terminal:

$f="$env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json"; if(Test-Path $f){Copy-Item $f "$f.bak" -Force; ($j=Get-Content $f -Raw|ConvertFrom-Json).confirmCloseAllTabs=$false; $j|ConvertTo-Json -Depth 100|Set-Content $f -Encoding UTF8}

⚠️ Important: Always test configurations locally before deploying across an environment. (See ⚠️ Things to look out for.)

⚠️ Things to look out for

RisksPotential ConsequencesReversals
Syntax inaccuracy and misconfigurations when editing JSON files.Modifying JSON files is a manual process that’s hard to reverse once done.

Syntax inaccuracies can make JSON configurations silently fail in the background, and misconfiguration can break Terminal functionality.

Before proceeding, enter the command below on a PowerShell prompt to backup your JSON file:

Copy-Item $settingsPath "$settingsPath.bak"

💡 NOTE: Replace $settingsPath with the location of your settings.json file.

Using Notepad to edit JSON files.Notepad is a plain text editor that requires users to manually and precisely format JSON files.Use other text editors that support JSON formats like Notepad++.

Alternatively, you can manually validate your JSON file’s contents using an online JSON validator

Not validating changes before deployment.Misconfigurations and syntax errors can easily go through without ample validation.Test configurations on a local machine before deploying.

Considerations when toggling the Terminal’s close all tabs dialog box

Enabling or disabling the confirmation prompt when closing multiple Terminal tabs can have significant effects on certain workflows. Below are some considerations you should remember when making such a change for yourself or across an environment.

Disabling confirmation prompts to streamline workflows

Without confirmation prompts, users can instantly close multiple Terminal tabs with just one click. This can help speed up the workflow of users exiting multiple Terminal sessions so they can focus on other tasks. However, it’s important to note that this is only ideal for use cases that frequently use one-off, short-lived scripts.

Enable confirmation prompts to avoid accidental closure of all open tabs

Enabling confirmation prompts can help secure sessions for users who leverage the Terminal for long-running background scripts. By having a precautionary prompt, unwanted Terminal session closures can be avoided, preventing the loss of important scripts. This can help reduce downtime and disruptions for script-reliant environments.

Local Group Policy and Registry methods

Currently, there’s no documented Registry value or Local Group Policy setting that can manage the Terminal’s confirmation dialog. If you want to deploy this configuration across multiple users, you can automatically edit the Terminal’s JSON file using PowerShell.

Troubleshooting common issues when closing all Terminal tabs

Issue #1: Changes not taking effect after configuration

There are multiple reasons why a JSON file configuration doesn’t immediately apply on the Terminal. First, ensure that your JSON syntax is accurate and the key-value pairs are positioned correctly within the file. Additionally, after editing, press Ctrl + S to save the file and then restart your Windows Terminal to apply the changes.

Issue #2: Settings option unavailable

First, verify if you have an updated Terminal version by entering Get-AppxPackage *windowsterminal* | Select Name, Version on a PowerShell prompt.

Verify Terminal version

Some settings, such as Warn when closing more than one tab, aren’t supported in older Windows Terminal versions. To access these settings, it’s important that you first update your Windows Terminal to the latest version via the Microsoft Store.

Enable confirmation prompts to avoid accidental closure of Terminal sessions

Confirmation prompts can be leveraged as a safeguard against unintended closure of multiple tabs. However, it’s ideal to disable this for users that prioritize smooth, seamless closure of Terminal sessions for faster workflows.

The Windows Terminal’s settings page and settings.json file allow users to toggle confirmation prompts for their personal account. Administrators can automate the Terminal’s JSON file configuration using PowerShell, allowing them to deploy confirmation dialog settings for other users.

Related topics:

You might also like

Ready to simplify the hardest parts of IT?