--window flag does not work as anticipated #15140

Closed
opened 2026-01-31 04:29:39 +00:00 by claunia · 1 comment
Owner

Originally created by @acederberg on GitHub (Sep 8, 2021).

Windows Terminal version (or Windows build number)

1.11.2421.0

Other Software

Windows 10 Pro 10.0.19043 Build 19043
Note that the version number provided for windows terminal is for the preview.

Steps to reproduce

Make sure all instances of windows terminal are closed first. Run the following script

wt --window 0
wt --window 1

by

powershell.exe -file

or just enter the script line by line into the terminal. I also tried running it from powershell ISE and got the same result.

Expected Behavior

Expected wt --window n to specify the nth window or spawn it. When no instances of wt are open, then the above script should open the zeroth and first windows.

Actual Behavior

Spawned both instances of wt into a single window. However when I run

wt --window 0
wt --window 2

I get the anticipated output, two separate windows both in the default profile.

Originally created by @acederberg on GitHub (Sep 8, 2021). ### Windows Terminal version (or Windows build number) 1.11.2421.0 ### Other Software Windows 10 Pro 10.0.19043 Build 19043 Note that the version number provided for windows terminal is for the preview. ### Steps to reproduce Make sure all instances of windows terminal are closed first. Run the following script wt --window 0 wt --window 1 by powershell.exe -file <name of script> or just enter the script line by line into the terminal. I also tried running it from powershell ISE and got the same result. ### Expected Behavior Expected `wt --window n` to specify the nth window or spawn it. When no instances of wt are open, then the above script should open the zeroth and first windows. ### Actual Behavior Spawned both instances of wt into a single window. However when I run wt --window 0 wt --window 2 I get the anticipated output, two separate windows both in the default profile.
Author
Owner

@zadjii-msft commented on GitHub (Sep 8, 2021):

Window IDs start at 1. 0 is a special reserved ID for "this window I'm currently running in". So when you do wt --window 0 ; wt --window 1, what's happening is the first commandline finds no windows, and assigns itself the ID 1. Then the second command runs, and runs itself in the first window.

The docs sorta mention this?

@zadjii-msft commented on GitHub (Sep 8, 2021): Window IDs start at 1. `0` is a special reserved ID for "this window I'm currently running in". So when you do `wt --window 0 ; wt --window 1`, what's happening is the first commandline finds _no_ windows, and assigns itself the ID 1. Then the second command runs, and runs itself in the first window. The docs [sorta mention this](https://docs.microsoft.com/en-us/windows/terminal/command-line-arguments?tabs=windows#target-a-specific-window)?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#15140