Command "wt -w 0 new-tab" open two tabs on new window #20737

Closed
opened 2026-01-31 07:22:39 +00:00 by claunia · 2 comments
Owner

Originally created by @erenaud3 on GitHub (Oct 26, 2023).

Windows Terminal version

1.19.2682.0

Windows build number

10.0.19045.2846

Other Software

No response

Steps to reproduce

I want to have a .cmd script which opens a new Terminal Preview windows containing N tabs (each tabs have same profile but different directory).

Example of my script :

wt -w 0 new-tab -p git-bash -d C:\path0 ; 
wt -w 0 new-tab -p git-bash -d C:\path1 ; 
wt -w 0 new-tab -p git-bash -d C:\path2 ; 
wt -w 0 new-tab -p git-bash -d C:\path3 ; 
wt -w 0 new-tab -p git-bash -d C:\path4 

Expected Behavior

I was expecting to get only my five tabs in my new windows (or at least, my five tabs + a sixth tab with default profile).

Plus, I was expecting my five tabs to be organized in the same way I organized my calls (first path0, then path1 and so on).

Actual Behavior

Instead, I always get 10 tabs : the five I was expecting (with git-bash profile) plus five with default profile.

Example, let us say that my default profile is "Windows powershell". I got the following :
image

Plus, the tabs with the profile I want are always organized randomly.

Originally created by @erenaud3 on GitHub (Oct 26, 2023). ### Windows Terminal version 1.19.2682.0 ### Windows build number 10.0.19045.2846 ### Other Software _No response_ ### Steps to reproduce I want to have a .cmd script which opens a new Terminal Preview windows containing N tabs (each tabs have same profile but different directory). Example of my script : ``` wt -w 0 new-tab -p git-bash -d C:\path0 ; wt -w 0 new-tab -p git-bash -d C:\path1 ; wt -w 0 new-tab -p git-bash -d C:\path2 ; wt -w 0 new-tab -p git-bash -d C:\path3 ; wt -w 0 new-tab -p git-bash -d C:\path4 ``` ### Expected Behavior I was expecting to get only my five tabs in my new windows (or at least, my five tabs + a sixth tab with default profile). Plus, I was expecting my five tabs to be organized in the same way I organized my calls (first path0, then path1 and so on). ### Actual Behavior Instead, I always get 10 tabs : the five I was expecting (with git-bash profile) plus five with default profile. Example, let us say that my default profile is "Windows powershell". I got the following : ![image](https://github.com/microsoft/terminal/assets/38557708/8a79df37-edb8-46e0-8421-f1dd67de9667) Plus, the tabs with the profile I want are always organized randomly.
Author
Owner

@zadjii-msft commented on GitHub (Oct 26, 2023):

The ; is a subcommand separator to wt.exe. When you call wt nt ; , that gets treated the same as wt new-tab ; new-tab implicitly.

You could of course just write the call all at once:

wt -w 0 nt -p git-bash -d C:\path0 ; nt -p git-bash -d C:\path1 ; nt -p git-bash -d C:\path2 ; nt -p git-bash -d C:\path3 ; nt -p git-bash -d C:\path4 

Does that work a bit better/?

@zadjii-msft commented on GitHub (Oct 26, 2023): The `;` is a subcommand separator to `wt.exe`. When you call `wt nt ; `, that gets treated the same as `wt new-tab ; new-tab` _implicitly_. You could of course just write the call all at once: ```cmd wt -w 0 nt -p git-bash -d C:\path0 ; nt -p git-bash -d C:\path1 ; nt -p git-bash -d C:\path2 ; nt -p git-bash -d C:\path3 ; nt -p git-bash -d C:\path4 ``` Does that work a bit better/?
Author
Owner

@erenaud3 commented on GitHub (Oct 26, 2023):

Yes, that definitely work a lot better !
Thank you very much for you amazingly fast answer ! 💯

I even ended up using your command line to create a new profile, which was what I was trying to accomplish in the first place.
Thanks again !!

@erenaud3 commented on GitHub (Oct 26, 2023): Yes, that definitely work a lot better ! Thank you very much for you amazingly fast answer ! 💯 I even ended up using your command line to create a new profile, which was what I was trying to accomplish in the first place. Thanks again !!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#20737