- Article
- 15 minutes to read
You can usewt.exe
to open a new instance of Windows Terminal from the command line. You can also use the execution aliasweight
instead of this.
note
Building Windows Terminal from source codeGitHub, you can open this build withwtd.exe
orweight
.
command line syntax
Dieweight
The command line accepts two types of values:optionsandcommands.optionsare a list of flags and other parameters that can control the behavior ofweight
command line as a whole.commandsSpecify the action or a semicolon-separated list of actions to implement. If no command is specified, the command is assumed to benew window
By default.
wt [options] [command ; ]
note
The behavior ofwt.exe
Command can be influenced by thewindowingBehavior property. This setting can be reset to the default between opening a new window or opening a new tab.
To display a help message with the available command line arguments, type:wt-h
,wt --help
,wt -?
, orww /?
.
options and commands
Below is the full list of supported commands and options for theweight
command line.
possibility | description |
---|---|
--Help ,-h ,-? ,/? | Displays the help message. |
- maximized ,-M | Starts the terminal maximized. |
--full screen ,-F | Starts the terminal in full screen mode. |
--Focus ,-f | Starts the terminal in focus mode. Can be combined withmaximized . |
--Window ,-w <window ID> | Launches the terminal in a specific window. |
New tab
command
command | Parameter | description | Values |
---|---|---|---|
new tab ,NT | --profile, -p Profilname | Creates a new tab based on the assigned profile name. | Profilname |
new tab ,NT | --start dir, -d start dir | Creates a new tab based on the assigned home directory path. | directory path |
new tab ,NT | command line | Creates a new tab based on the assigned command line. | Executable with optional commands |
new tab ,NT | --Title | Creates a new tab with the assigned title. | Text to use as tab title |
new tab ,NT | --tab color | Creates a new tab with the assigned tab color. | Hex color as #RGB or #RRGGBB |
Top
If you change the title of a tab in Windows Terminal and want that title to remain, you need to enable theSuppress application titleoption by setting it toIs correct
.
Split disc
command
command | Parameter | description | Values |
---|---|---|---|
split disc ,sp | -H, --horizontal ,-V, --vertical | Creates a new split pane either horizontally or vertically. | N/A. No additional values to assign. |
split disc ,sp | --profile, -p Profilname | Creates a new split window based on the assigned command line profile. If this parameter is not assigned, the default profile is used. | Profilname |
split disc ,sp | --start dir, -d start dir | Creates a new split pane based on the assigned home directory path. If this parameter is not assigned, the default startup directory is used. | directory path |
split disc ,sp | --Title | Creates a new pane with the assigned title. | Text to use as tab title |
split disc ,sp | --tab color | Creates a new split pane with the assigned tab color. | Hex color as #RGB or #RRGGBB |
split disc ,sp | --size, -s size | Creates a new split pane of the assigned size. | Float specifying the portion of the parent range to use, represented by a decimal number. For example,.4 to represent 40% of the parent area. |
split disc ,sp | command line | Creates a new split pane based on the assigned command line. | Executable with optional commands |
split disc ,sp | --duplicate, -D | Creates a new split pane that is a duplicate of the current pane. | N/A. No additional values to assign. |
focus tab
command
command | Parameter | description | Values |
---|---|---|---|
focus tab ,ft | --target, -t tab-index | Focuses on a specific tab according to its tab index number. | Tab index as an integer |
Move-Focus
command
command | Parameter | description | Values |
---|---|---|---|
movement focus ,mf | Direction | Move the focus between the windows in the indicated direction. | hoch ,Low ,links , orto the right values accepted. |
note
If you open Windows Terminal from cmd (Command Prompt) and want to use your custom "cmd" profile settings, you must use the commandwt -p cmd
. Otherwise you runOriginallyProfile settings, just usewt cmd
.
Examples of command line arguments
The commands may vary slightly depending on the command line used.
Passing an argument to the standard shell
Invoke to launch an instance of Windows Terminal and run a commandwt.exe
followed by your command.
Here's an example of calling Windows Terminal to pass aRingCommand argument to echo an IP address:
wt ping on learn.microsoft.com
Here is an example of calling Windows Terminal to open a new tab with a PowerShell command line and confirm the callstart serviceCommand and open another new tab with Windows command prompt open/k
Directory:
wt new-tab PowerShell -c Start-Dienst ; new-tab cmd /k dir
Target a specific window
Below are examples of how to target specific windows using--window,-w
Possibility.
- command prompt
- Power Shell
- Linux
// 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// In the terminal window, open a new tab called foo with the default profile. If foo doesn't exist, create a new window named foo.wt -w foo nt
Open a new profile instance
In this case, to open a new terminal instance, the command will open the profile named "Ubuntu-18.04", type:
- command prompt
- Power Shell
- Linux
wt -p "Free-18.04"
Die-p
Flag is used to specify the Windows Terminal profile to open. Replace "Ubuntu-18.04" with the name of any terminal profile you have installed. This always opens a new window. Windows Terminal is not yet able to open new tabs or panes in an existing instance.
Target a directory
To specify the folder to use as the console startup directory, in this case the d:\ directory, type:
- command prompt
- Power Shell
- Linux
wt -d d:\
Multiple tabs
Type the following to open a new multi-tabbed terminal instance:
- command prompt
- Power Shell
- Linux
weight ; ;
Type the following to open a new terminal instance with multiple tabs, in this case a Command Prompt profile and a PowerShell profile:
- command prompt
- Power Shell
- Linux
wt -p "command prompt" ; new-tab -p "Windows PowerShell"
Multiple slices
To open a new terminal instance with a tab with three panes running a Command Prompt profile, a PowerShell profile, and your default profile with a WSL command line, type:
- command prompt
- Power Shell
- Linux
wt -p "command prompt" ; split-pane -p "Windows PowerShell" ; split-pane -H wsl.exe
Die-H
flag (or--horizontal
) indicates that the panes should be split horizontally. the-V
flag (or--vertical
) indicates that the panes should be split vertically.
Multiple tabs and areas
Dienew tab
andsplit disc
Commands can be sequenced to get multiple tabs, each with split windows. To open a new terminal instance with two tabs, each with two windows running a command prompt and a WSL command line, type the following, with each tab in a different directory:
- command prompt
- Power Shell
- Linux
wt -p "command prompt" ; split-pane -V wsl.exe ; new-tab -d c:\ ; split-pane -H -d c:\wsl.exe
area title
To open a new terminal instance with custom titles for each terminal pane, use the--Title
Dispute. To set the title of each pane when opening multiple tabs, type:
- command prompt
- Power Shell
- Linux
wt --title tabname1 ; new-tab -p "Ubuntu-18.04" --title tabname2
Panels on the same tab can have different titles that affect the tab title depending on which panel has focus. To name independent areas, you can set the title after dividing the areas by typing:
- command prompt
- Power Shell
- Linux
wt --title pane1 ; split-pane -p "prompt" --title pane2
Use application title
To open a new terminal instance that allows applications inside it to set the tab title by sending title change messages, use the--useApplicationTitle
Flag. To suppress these messages, use the--suppressApplicationTitle
Flag. If none of these flags are provided, the behavior is inherited from the profile settings. To open a titled tabtab name
which will not be overwritten by the application, type:
- command prompt
- Power Shell
- Linux
wt --title Registerkartenname --suppressApplicationTitle
tab color
To open a new terminal instance with custom tab colors, use the--tab color
Dispute. This argument overrides the value defined in the profile, but can also be overridden with the tab color picker. The following example creates a new terminal with two different colored tabs:
- command prompt
- Power Shell
- Linux
wt --tabColor #009999 ; new-tab --tabColor #f59218
When--tab color
is set for a tab, it is mapped to the first pane of that tab. Therefore, in a multi-pane tab, the color is applied only when the first pane has focus. To set the tab color for additional panels, you need to add the--tab color
parameters forsplit disc
also subcommand. The following example creates a tab with two panes, with the tab colors set for each pane:
wt new-tab --tabColor '#009999' `; split window --tabColor '#f59218'
color scheme
To open a new terminal instance with a specific color scheme (instead of thecolor scheme
set in profile), use the--Color scheme
Dispute. This argument overrides the value defined in the profile.
- command prompt
- Power Shell
- Linux
wt --colorScheme Vintage ; split-pane --colorScheme "Tango Light"
tab focus
To open a new terminal instance with a specific tab in focus, use the-t
flag (or--Goal
) along with the tab index number. How to open your default profile on the first tab and the "Ubuntu-18.04" profile on the second tab (-t 1
), enter:
- command prompt
- Power Shell
- Linux
weight ; new-tab -p "Ubuntu-18.04" ; Focus tab -t 1
Examples of multiple PowerShell commands
Windows Terminal uses the semicolon character;
as a delimiter to separate commands in theweight
command line. Unfortunately, PowerShell uses that too;
as a command separator. To get around this, you can use the following tricks to run multipleweight
Commands from PowerShell. All of the following examples create a new terminal window with three panes - one with Command Prompt, one with PowerShell, and the last with WSL.
The following examples do not useBeginning
to run the command line. Instead, there are two other methods to bypass the command line:
- Just escape the semicolons so that
Power Shell
ignore them and forward them directlyweight
. - Use
--%
, so PowerShell treats the rest of the command line as arguments to the application.
wt new-tab "cmd" `; split-pane -p "Windows PowerShell" `; split-pane -H wsl.exe
wt --% new-tab cmd ; split-pane -p "Windows PowerShell" ; split-pane -H wsl.exe
In both examples, the newly created Windows terminal window creates the window by correctly parsing all command line arguments provided.
However, these methods areNotis currently recommended because PowerShell waits for the newly created terminal window to close before returning control to PowerShell. By default, PowerShell always waits for Windows Store applications (like Windows Terminal) to close before returning to the command prompt. Note that this is different from the behavior of the command prompt, which immediately returns to the command prompt.