Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions TerminalDocs/TOC.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
href: customize-settings/color-schemes.md
- name: Rendering
href: customize-settings/rendering.md
- name: Actions
href: customize-settings/actions.md
- name: Profile - General
href: customize-settings/profile-general.md
- name: Profile - Appearance
href: customize-settings/profile-appearance.md
- name: Profile - Advanced
href: customize-settings/profile-advanced.md
- name: Actions
href: customize-settings/actions.md
- name: Command line arguments
href: command-line-arguments.md
- name: Command palette
Expand All @@ -34,6 +34,8 @@
href: panes.md
- name: Dynamic profiles
href: dynamic-profiles.md
- name: JSON fragment extensions
href: json-fragment-extensions.md
- name: Cascadia Code
href: cascadia-code.md
- name: Tips and tricks
Expand Down
72 changes: 58 additions & 14 deletions TerminalDocs/command-line-arguments.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
---
title: Windows Terminal command-line arguments
description: Learn how to create command-line arguments for Windows Terminal.
title: Windows Terminal command line arguments
description: Learn how to create command line arguments for Windows Terminal.
author: cinnamon-msft
ms.author: cinnamon
ms.date: 1/28/2021
ms.date: 02/25/2021
ms.topic: how-to
---

# Using command-line arguments for Windows Terminal
# Using command line arguments for Windows Terminal

You can use `wt.exe` to open a new instance of Windows Terminal from the command line. You can also use the execution alias `wt` instead.

> [!NOTE]
> If you built Windows Terminal from the source code on [GitHub](https://github.com/microsoft/terminal), you can open that build using `wtd.exe` or `wtd`.

![Windows Terminal command-line argument for split panes](./images/terminal-command-args.gif)
![Windows Terminal command line argument for split panes](./images/terminal-command-args.gif)

## Command line syntax

Expand All @@ -24,7 +24,7 @@ The `wt` command line accepts two types of values: **options** and **commands**.
wt [options] [command ; ]
```

To display a help message listing the available command-line arguments, enter: `wt -h`, `wt --help`, `wt -?`, or `wt /?`.
To display a help message listing the available command line arguments, enter: `wt -h`, `wt --help`, `wt -?`, or `wt /?`.

## Options and commands

Expand All @@ -36,6 +36,7 @@ Below is the full list of supported commands and options for the `wt` command li
| `--maximized`, `-M` | Launches the terminal maximized. |
| `--fullscreen`, `-F` | Launches the terminal as full screen. |
| `--focus`, `-f` | Launches the terminal in the focus mode. Can be combined with `maximized`. |
| `--window`, `-w` `<window-id>` | Launches the terminal in a specific window. |

| Command | Parameters | Description |
| ------- | ---------- | ----------- |
Expand All @@ -44,16 +45,62 @@ Below is the full list of supported commands and options for the `wt` command li
| `focus-tab`, `ft` | `--target, -t tab-index` | Focuses on a specific tab. |
| `move-focus`, `mf` | `direction` | Move focus between panes in the given direction. Accepts one of `up`, `down`, `left`, `right`. |

> [!IMPORTANT]
> The `--tabColor` parameter of the `new-tab` subcommand, `--tabColor` and `--size,-s size` parameters of the `split-pane` subcommand, and the `move-focus` subcommand are only available in [Windows Terminal Preview](https://aka.ms/terminal-preview/).

> [!NOTE]
> When opening Windows Terminal from cmd (Command Prompt), if you want to use your custom "cmd" profile settings, you will need to use the command `wt -p cmd`. Otherwise, to run your *default* profile settings, just use `wt cmd`.

## Command line argument examples

Commands may vary slightly depending on which command line you're using.

### Target a specific window

Below are examples of how to target specific windows using the `--window,-w` option.

<!-- Start tab selectors. -->
#### [Command Prompt](#tab/windows)

```cmd
// Open a new tab with the default profile in the current window
wt -w 0 nt

// Open a new tab in a new window with the default profile
wt -w -1 nt

// Open a new tab in the first-created terminal window with the default profile
wt -w 1 nt
```

#### [PowerShell](#tab/powershell)

```powershell
// Open a new tab with the default profile in the current window
wt -w 0 nt

// Open a new tab in a new window with the default profile
wt -w -1 nt

// Open a new tab in the first-created terminal window with the default profile
wt -w 1 nt
```

#### [Linux](#tab/linux)

```bash
// Open a new tab with the default profile in the current window
cmd.exe /c "wt.exe" -w 0 nt

// Open a new tab in a new window with the default profile
cmd.exe /c "wt.exe" -w -1 nt

// Open a new tab in the first-created terminal window with the default profile
cmd.exe /c "wt.exe" -w 1 nt
```

Execution aliases do not work in WSL distributions. If you want to use wt.exe from a WSL command line, you can spawn it from CMD directly by running `cmd.exe`. The `/c` option tells CMD to terminate after running.

---
<!-- End tab selectors. -->

### Open a new profile instance

To open a new terminal instance, in this case the command will open the profile named "Ubuntu-18.04", enter:
Expand Down Expand Up @@ -82,7 +129,7 @@ Execution aliases do not work in WSL distributions. If you want to use wt.exe fr
---
<!-- End tab selectors. -->

The `-p` flag is used to specify the Windows Terminal profile that should be opened. Substitute "Ubuntu-18.04" with the name of any terminal profile that you have installed. This will always open a new window. Windows Terminal is not yet capable of opening new tabs or panes in an existing instance.
The `-p` flag is used to specify the Windows Terminal profile that should be opened. Substitute "Ubuntu-18.04" with the name of any terminal profile that you have installed. This will always open a new window. Windows Terminal is not yet capable of opening new tabs or panes in an existing instance.

### Target a directory

Expand Down Expand Up @@ -260,7 +307,7 @@ Execution aliases do not work in WSL distributions. If you want to use wt.exe fr
---
<!-- End tab selectors. -->

### Tab color ([Preview](https://aka.ms/terminal-preview))
### Tab color

To open a new terminal instance with custom tab colors, use the `--tabColor` argument. This argument overrides the value defined in the profile, but can be overridden as well using the tab color picker. In the following example, a new terminal is created with two tabs of different colors:

Expand Down Expand Up @@ -294,9 +341,6 @@ When `--tabColor` is set for a tab, it is associated with the first pane of this
wt new-tab --tabColor #009999 ; split-pane --tabColor #f59218
```

> [!IMPORTANT]
> This feature is only available in [Windows Terminal Preview](https://aka.ms/terminal-preview).

### Tab focus

To open a new terminal instance with a specific tab in focus, use the `-t` flag (or `--target`), along with the tab-index number. To open your default profile in the first tab and the "Ubuntu-18.04" profile focused in the second tab (`-t 1`), enter:
Expand Down
7 changes: 2 additions & 5 deletions TerminalDocs/command-palette.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: Windows Terminal Command Palette
description: Learn how to use the command palette in the Windows Terminal.
description: Learn how to use the command palette in Windows Terminal.
author: cinnamon-msft
ms.author: cinnamon
ms.date: 1/28/2021
ms.date: 02/25/2021
ms.topic: how-to
ms.localizationpriority: high
---
Expand Down Expand Up @@ -32,9 +32,6 @@ You can add a custom key binding for invoking the command palette in the command
{ "command": "commandPalette", "launchMode": "commandLine", "keys": "" }
```

> [!IMPORTANT]
> The `"launchMode"` setting is only available in [Windows Terminal Preview](https://aka.ms/terminal-preview).

## Adding an icon to a command

You can optionally add an icon to a command defined in your settings.json that appears in the command palette. This can be done by adding the `icon` property to the action. Icons can be a path to an image, a symbol from [Segoe MDL2 Assets](https://docs.microsoft.com/windows/uwp/design/style/segoe-ui-symbol-font), or any character, including emojis.
Expand Down
2 changes: 1 addition & 1 deletion TerminalDocs/custom-terminal-gallery/custom-schemes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Custom Color Schemes guide
title: Windows terminal Custom Color Schemes guide
description: Some sample configurations for Windows Terminal.
author: cinnamon-msft
ms.author: cinnamon
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Windows Terminal Frosted Glass Theme Configuration
title: Windows Terminal Frosted Glass Theme
description: This is a sample configuration for a frosted glass theme.
author: cinnamon-msft
ms.author: cinnamon
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Windows Terminal Powerline in PowerShell Configuration
title: Windows Terminal Powerline in PowerShell
description: This is the configuration and theme for Powerline in PowerShell.
author: cinnamon-msft
ms.author: cinnamon
Expand Down
2 changes: 1 addition & 1 deletion TerminalDocs/custom-terminal-gallery/raspberry-ubuntu.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Windows Terminal Raspberry Ubuntu Configuration
title: Windows Terminal Raspberry Ubuntu
description: This is the theme for Raspberry Ubuntu.
author: cinnamon-msft
ms.author: cinnamon
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Windows Terminal Retro Command Prompt Configuration
title: Windows Terminal Retro Command Prompt
description: This is the configuration for a retro command prompt in Windows Terminal.
author: cinnamon-msft
ms.author: cinnamon
Expand Down
Loading