Opening Split Screen Terminal from a script is impossible #23954

Open
opened 2026-01-31 08:57:12 +00:00 by claunia · 7 comments
Owner

Originally created by @DerekZiemba on GitHub (Jan 12, 2026).

Copilot also couldn't figure this out and ran in circles.
How can one call WindowsTerminal to create multiple terminals with splits from a script? It only works from an interactive terminal, requiring you to copy paste the command.

Windows Terminal version

1.23.13503.0

Windows build number

10.0.22631.0

Other Software

No response

Steps to reproduce

I want to start 4 terminals when I run npm run watch. The following commands all work from an interactive shell, but do not work if you put them in a script or inside a package.json script.

cmd.exe:
wt.exe -w 'LFE' -p 'bash' --title 'watch-dev' --suppressApplicationTitle npm run watch-dev ; split-pane -H -p 'Powershell' --title 'watch-prod' --suppressApplicationTitle npm run watch-prod ^; move-focus up ; split-pane -p 'Powershell' --title 'watch-tsc' --suppressApplicationTitle npm run watch-tsc ; move-focus down ; split-pane -p 'Powershell' --title 'watch-test' --suppressApplicationTitle npm run watch-test

bash.exe:
wt.exe -w 'LFE' -p 'Powershell' --title 'watch-dev' --suppressApplicationTitle npm run watch-dev \; split-pane -H -p 'Powershell' --title 'watch-prod' --suppressApplicationTitle npm run watch-prod \; move-focus up \; split-pane -p 'Powershell' --title 'watch-tsc' --suppressApplicationTitle npm run watch-tsc \; move-focus down \; split-pane -p 'Powershell' --title 'watch-test' --suppressApplicationTitle npm run watch-test

pwsh.exe:
wt.exe -w 'LFE' -p 'Powershell' --title 'watch-dev' --suppressApplicationTitle npm run watch-dev `; split-pane -H -p 'Powershell' --title 'watch-prod' --suppressApplicationTitle npm run watch-prod `; move-focus up `; split-pane -p 'Powershell' --title 'watch-tsc' --suppressApplicationTitle npm run watch-tsc `; move-focus down `; split-pane -p 'Powershell' --title 'watch-test' --suppressApplicationTitle npm run watch-test

Expected Behavior

To be able to launch a split screen terminal from a script.

Actual Behavior

None of the following work:

  1. From package.json
{
  "scripts": {
    "watch-dev": "      webpack --config webpack/webpack.dev.js   --watch",
    "watch-prod": "     webpack --config webpack/webpack.prod.js  --watch",
    "watch-tsc": "      tsc -project tsconfig.json                --watch",
    "watch-test": "     npx jest --maxWorkers=25%              --watchAll",
    "watch": "wt.exe -w 'LFE' -p 'Powershell' --title 'watch-dev' --suppressApplicationTitle npm run watch-dev \\; split-pane -H -p 'Powershell' --title 'watch-prod' --suppressApplicationTitle npm run watch-prod \\; move-focus up \\; split-pane -p 'Powershell' --title 'watch-tsc' --suppressApplicationTitle npm run watch-tsc \\; move-focus down \\; split-pane -p 'Powershell' --title 'watch-test' --suppressApplicationTitle npm run watch-test",
    // Doesnt work if create scripts for this either
    "watch:pwsh": "pwsh inSplitTerminal.ps1 -- watch-dev watch-prod watch-tsc watch-test",
    "watch:bash": "bash inSplitTerminal.sh -- watch-dev watch-prod watch-tsc watch-test",
    "watch:cmd": "cmd inSplitTerminal.cmd -- watch-dev watch-prod watch-tsc watch-test",
  },
}
  1. From Powershell script: inSplitTerminal.ps1
    • Fails when run directly (the same command used successfully from an interactive console earlier). Just create an empty file & paste the command that interactively worked earlier.
    • Fails with Invoke-Expression
    • Fails with Start-Process
    • Fails with [ProcessStartInfo]::new('wt.exe') & Arguments
    • Fails with [ProcessStartInfo]::new('wt.exe') & ArgumentList
    • Fails with cmd /c "$cmd"
  2. From bash script: inSplitTerminal.sh
    • Fails when run directly (the same command used successfully from an interactive console earlier)
    • Fails with eval
  3. From cmd/bat script: inSplitTerminal.cmd
    • Fails when run directly (the same command used successfully from an interactive console earlier)
    • I didn't bother generating a string to invoke from the passed in args.
Originally created by @DerekZiemba on GitHub (Jan 12, 2026). Copilot also couldn't figure this out and ran in circles. How can one call WindowsTerminal to create multiple terminals with splits from a script? It only works from an interactive terminal, requiring you to copy paste the command. ### Windows Terminal version 1.23.13503.0 ### Windows build number 10.0.22631.0 ### Other Software _No response_ ### Steps to reproduce I want to start 4 terminals when I run `npm run watch`. The following commands all work from an interactive shell, but do not work if you put them in a script or inside a package.json script. **cmd.exe**: `wt.exe -w 'LFE' -p 'bash' --title 'watch-dev' --suppressApplicationTitle npm run watch-dev ; split-pane -H -p 'Powershell' --title 'watch-prod' --suppressApplicationTitle npm run watch-prod ^; move-focus up ; split-pane -p 'Powershell' --title 'watch-tsc' --suppressApplicationTitle npm run watch-tsc ; move-focus down ; split-pane -p 'Powershell' --title 'watch-test' --suppressApplicationTitle npm run watch-test ` **bash.exe**: `wt.exe -w 'LFE' -p 'Powershell' --title 'watch-dev' --suppressApplicationTitle npm run watch-dev \; split-pane -H -p 'Powershell' --title 'watch-prod' --suppressApplicationTitle npm run watch-prod \; move-focus up \; split-pane -p 'Powershell' --title 'watch-tsc' --suppressApplicationTitle npm run watch-tsc \; move-focus down \; split-pane -p 'Powershell' --title 'watch-test' --suppressApplicationTitle npm run watch-test ` **pwsh.exe**: ```wt.exe -w 'LFE' -p 'Powershell' --title 'watch-dev' --suppressApplicationTitle npm run watch-dev `; split-pane -H -p 'Powershell' --title 'watch-prod' --suppressApplicationTitle npm run watch-prod `; move-focus up `; split-pane -p 'Powershell' --title 'watch-tsc' --suppressApplicationTitle npm run watch-tsc `; move-focus down `; split-pane -p 'Powershell' --title 'watch-test' --suppressApplicationTitle npm run watch-test``` ### Expected Behavior To be able to launch a split screen terminal from a script. ### Actual Behavior None of the following work: 1. **From package.json** ```jsonc { "scripts": { "watch-dev": " webpack --config webpack/webpack.dev.js --watch", "watch-prod": " webpack --config webpack/webpack.prod.js --watch", "watch-tsc": " tsc -project tsconfig.json --watch", "watch-test": " npx jest --maxWorkers=25% --watchAll", "watch": "wt.exe -w 'LFE' -p 'Powershell' --title 'watch-dev' --suppressApplicationTitle npm run watch-dev \\; split-pane -H -p 'Powershell' --title 'watch-prod' --suppressApplicationTitle npm run watch-prod \\; move-focus up \\; split-pane -p 'Powershell' --title 'watch-tsc' --suppressApplicationTitle npm run watch-tsc \\; move-focus down \\; split-pane -p 'Powershell' --title 'watch-test' --suppressApplicationTitle npm run watch-test", // Doesnt work if create scripts for this either "watch:pwsh": "pwsh inSplitTerminal.ps1 -- watch-dev watch-prod watch-tsc watch-test", "watch:bash": "bash inSplitTerminal.sh -- watch-dev watch-prod watch-tsc watch-test", "watch:cmd": "cmd inSplitTerminal.cmd -- watch-dev watch-prod watch-tsc watch-test", }, } ``` 2. **From Powershell script: inSplitTerminal.ps1** - Fails when run directly (the same command used successfully from an interactive console earlier). Just create an empty file & paste the command that interactively worked earlier. - Fails with Invoke-Expression - Fails with Start-Process - Fails with `[ProcessStartInfo]::new('wt.exe')` & `Arguments` - Fails with `[ProcessStartInfo]::new('wt.exe')` & `ArgumentList` - Fails with `cmd /c "$cmd"` 3. **From bash script: inSplitTerminal.sh** - Fails when run directly (the same command used successfully from an interactive console earlier) - Fails with eval 4. **From cmd/bat script: inSplitTerminal.cmd** - Fails when run directly (the same command used successfully from an interactive console earlier) - I didn't bother generating a string to invoke from the passed in args.
claunia added the Needs-TriageIssue-BugNeeds-Attention labels 2026-01-31 08:57:12 +00:00
Author
Owner

@DHowett commented on GitHub (Jan 12, 2026):

Fails, fails, fails, fails, fails

Can you share what's actually happening? How does it fail? With an error code, with a crash, with what?

@DHowett commented on GitHub (Jan 12, 2026): > Fails, fails, fails, fails, fails Can you share what's actually happening? How does it fail? With an error code, with a crash, with what?
Author
Owner

@DHowett commented on GitHub (Jan 12, 2026):

@vishalharkal15 please leave.

@DHowett commented on GitHub (Jan 12, 2026): @vishalharkal15 please leave.
Author
Owner

@DerekZiemba commented on GitHub (Jan 12, 2026):

Summary: It appears it may actually be an issue with VSCode's Console Host.


Can you share what's actually happening? How does it fail? With an error code, with a crash, with what?

In many different ways depending on how things are escaped. It should be trivial to test yourself. One thing I believe is causing problems is spaces need to be escaped even when quoted, either with ' or ".
A basic test:

  • From a powershell terminal, paste the following.
      wt.exe -w 'MultiPaneTest' `
        --title 'topleft' --suppressApplicationTitle pwsh -Interactive -NoExit -c echo 'The Top Left Window Pane ' `; `
        split-pane -V --title 'topright' --suppressApplicationTitle pwsh -Interactive -NoExit -c echo 'The TopRight Window Pane' `; `
        split-pane -H --title 'bottomright' --suppressApplicationTitle pwsh -Interactive -NoExit -c echo 'Bottom` Right` With` Escaped` Spaces' `; `
        move-focus left `; `
        split-pane -H --title 'bottomleft' --suppressApplicationTitle pwsh -Interactive -NoExit -c echo 'Bottom` Left` With Some Escaped` Spaces' 
    
  • Observe you get 4 quadrants. Now create a test.ps1 file & paste the command there.
    (Get-History | % { $_.CommandLine } | where { $_ -match '^\s*wt.exe.+MultiPaneTest' } | select -last 1) >> test.ps1
  • Now try to run the script & suddenly you will get something like
    [error 2147942402 (0x80070002) when launching `"pwsh -Interactive -NoExit -c echo The" Top Left Window Pane ']
    The system cannot find the file specified.
    
    • NOTE: Only if you try to run it from VSCodes integrated terminal.

At this point, much to my surprise, I found it actually works...

Image

What I did differently while creating this test:

  1. I noticed --appendCommandLine "Appends the provided command-line to the profile's default command instead of replacing it" . This got me thinking that normally it may just straight replace the profiles commandline, so I stopped specifying a Profile. I've since discovered this doesn't matter & it's VSCode that's the issue.
  2. In the repo, I created a watch.ps1 script with the content:
     wt.exe -w 'LFE' `
       --title 'watch-dev' --suppressApplicationTitle npm run watch-dev `; `
       split-pane -V --title 'watch-prod' --suppressApplicationTitle npm run watch-prod `; `
       move-focus left `; `
       split-pane -H --title 'watch-tsc' --suppressApplicationTitle npm run watch-tsc `; `
       move-focus right `; `
       split-pane -H --title 'watch-test' --suppressApplicationTitle npm run watch-test
    
    • I worked exclusively inside Windows Terminal whereas before I was working in VSCode & using the integrated terminal. This appears to be the problem. More on this later. But the same command's & shell specific variants DO NOT WORK if using VSCode's Integrated Terminal. Does not matter if you use Bash, SH, CMD, PWSH, or WindowsPowershell.
    • From windows terminal I ran & .\scripts\watch.ps1. This crashed Windows Terminal. I've seen this a few times now, seems random. It worked later when I tried it again. Image

The issue is actually that you can't launch WindowsTerminal with multiple panes if you launch it from vscode.

I no longer have no idea what the bug actually is anymore or that if this is even a WindowsTerminal issue. I only now noticed this because previously I did everything with vscode.

  • From an npm package.json shell script:

    "watch:sh": "wt.exe -w 'LFE' --title 'watch-dev' --suppressApplicationTitle npm run watch-dev \\; split-pane -V --title 'watch-prod' --suppressApplicationTitle npm run watch-prod \\; move-focus left \\; split-pane -H --title 'watch-tsc' --suppressApplicationTitle npm run watch-tsc \\; move-focus right \\; split-pane -H --title 'watch-test' --suppressApplicationTitle npm run watch-test",
    

    I get [error 2147942402 (0x80070002) when launching "npm run watch-dev"'] The system cannot find the file specified.`

  • From an npm package.json pwsh script, it's difficult to escape properly and pass to powershell.

    • Can't just use ` bcus bash: -c: line 1: unexpected EOF while looking for matching ``'.
    • Can't escape ` as it's not recognized and results in Please ensure that the file is correctly formatted.
    • It's impossible AFAIK to escape things properly & be compatible with powershell's "`" escape.
       "watch:pwsh": "pwsh -c { wt.exe -w 'LFE' --title 'watch-dev' --suppressApplicationTitle npm run watch-dev \\`; split-pane -V --title 'watch-prod' --suppressApplicationTitle npm run watch-prod \\`; move-focus left \\`; split-pane -H --title 'watch-tsc' --suppressApplicationTitle npm run watch-tsc \\`; move-focus right \\`; split-pane -H --title 'watch-test' --suppressApplicationTitle npm run watch-test }"
      
    • Because it can't be escaped properly in an npm package.json script, I instead put the command in its own file. But this also doesn't work. ex: "watch:pwsh": "pwsh -c ./scripts/watch.ps1",
      NOTE pwsh -c ./scripts/watch.ps1 works fine when run from windows terminal.
  • pwsh -c ./scripts/watch.ps1 DOES NOT WORK if run in vscode's Integrated Terminal under Bash, PWSH, or CMD

    • In WinTerminal using CMD this works: powershell .\scripts\watch.ps1
    • In VSCode using CMD THIS DOES NOT WORK
  • In WinTerminal using CMD this works: wt.exe -w 'LFE' -p 'bash' --title 'watch-dev' --suppressApplicationTitle npm run watch-dev ; split-pane -H -p 'Powershell' --title 'watch-prod' --suppressApplicationTitle npm run watch-prod ^; move-focus up ; split-pane -p 'Powershell' --title 'watch-tsc' --suppressApplicationTitle npm run watch-tsc ; move-focus down ; split-pane -p 'Powershell' --title 'watch-test' --suppressApplicationTitle npm run watch-test

    • In VSCode using CMD THIS DOES NOT WORK
    • In VSCode, also doesn't work if you put the command in watch.cmd
  • In WinTerminal using Bash this works: wt.exe -w 'LFE' --title 'watch-dev' --suppressApplicationTitle npm run watch-dev \; split-pane -V --title 'watch-prod' --suppressApplicationTitle npm run watch-prod \; move-focus left \; split-pane -H --title 'watch-tsc' --suppressApplicationTitle npm run watch-tsc \; move-focus right \; split-pane -H --title 'watch-test' --suppressApplicationTitle npm run watch-test

    • In VSCode using Bash THIS DOES NOT WORK
    • In VSCode, also doesn't work if you put the command in watch.sh
Image
@DerekZiemba commented on GitHub (Jan 12, 2026): Summary: It appears it may actually be an issue with VSCode's Console Host. ------------------------------------------- > Can you share what's actually happening? How does it fail? With an error code, with a crash, with what? In many different ways depending on how things are escaped. It should be trivial to test yourself. One thing I believe is causing problems is spaces need to be escaped even when quoted, either with ' or ". A basic test: - From a powershell terminal, paste the following. ```pwsh wt.exe -w 'MultiPaneTest' ` --title 'topleft' --suppressApplicationTitle pwsh -Interactive -NoExit -c echo 'The Top Left Window Pane ' `; ` split-pane -V --title 'topright' --suppressApplicationTitle pwsh -Interactive -NoExit -c echo 'The TopRight Window Pane' `; ` split-pane -H --title 'bottomright' --suppressApplicationTitle pwsh -Interactive -NoExit -c echo 'Bottom` Right` With` Escaped` Spaces' `; ` move-focus left `; ` split-pane -H --title 'bottomleft' --suppressApplicationTitle pwsh -Interactive -NoExit -c echo 'Bottom` Left` With Some Escaped` Spaces' ``` - Observe you get 4 quadrants. Now create a test.ps1 file & paste the command there. `(Get-History | % { $_.CommandLine } | where { $_ -match '^\s*wt.exe.+MultiPaneTest' } | select -last 1) >> test.ps1` - Now try to run the script & suddenly you will get something like ```log [error 2147942402 (0x80070002) when launching `"pwsh -Interactive -NoExit -c echo The" Top Left Window Pane '] The system cannot find the file specified. ``` - NOTE: Only if you try to run it from VSCodes integrated terminal. ## At this point, much to my surprise, I found it actually works... <img width="1326" height="860" alt="Image" src="https://github.com/user-attachments/assets/e71dc743-5985-4cd6-bd16-dc2ff6e9a53d" /> ### What I did differently while creating this test: 1. I noticed [`--appendCommandLine` *"Appends the provided command-line to the profile's default command instead of replacing it"* ](https://learn.microsoft.com/en-us/windows/terminal/command-line-arguments?tabs=linux). This got me thinking that normally it may just straight replace the profiles commandline, so I stopped specifying a Profile. I've since discovered this doesn't matter & it's VSCode that's the issue. 3. In the repo, I created a `watch.ps1` script with the content: ```pwsh wt.exe -w 'LFE' ` --title 'watch-dev' --suppressApplicationTitle npm run watch-dev `; ` split-pane -V --title 'watch-prod' --suppressApplicationTitle npm run watch-prod `; ` move-focus left `; ` split-pane -H --title 'watch-tsc' --suppressApplicationTitle npm run watch-tsc `; ` move-focus right `; ` split-pane -H --title 'watch-test' --suppressApplicationTitle npm run watch-test ``` - I worked exclusively inside Windows Terminal whereas before I was working in VSCode & using the integrated terminal. This appears to be the problem. More on this later. But the same command's & shell specific variants **DO NOT WORK** if using VSCode's Integrated Terminal. Does not matter if you use Bash, SH, CMD, PWSH, or WindowsPowershell. - From windows terminal I ran `& .\scripts\watch.ps1`. This crashed Windows Terminal. I've seen this a few times now, seems random. It worked later when I tried it again. <img width="1233" height="2084" alt="Image" src="https://github.com/user-attachments/assets/a833d322-7107-44fc-8d29-ad322859c8bb" /> ## The issue is actually that you can't launch WindowsTerminal with multiple panes if you launch it from vscode. I no longer have no idea what the bug actually is anymore or that if this is even a WindowsTerminal issue. I only now noticed this because previously I did everything with vscode. - From an npm package.json shell script: ```json "watch:sh": "wt.exe -w 'LFE' --title 'watch-dev' --suppressApplicationTitle npm run watch-dev \\; split-pane -V --title 'watch-prod' --suppressApplicationTitle npm run watch-prod \\; move-focus left \\; split-pane -H --title 'watch-tsc' --suppressApplicationTitle npm run watch-tsc \\; move-focus right \\; split-pane -H --title 'watch-test' --suppressApplicationTitle npm run watch-test", ``` I get `[error 2147942402 (0x80070002) when launching `"npm run watch-dev"'] The system cannot find the file specified.` - From an npm package.json pwsh script, it's difficult to escape properly and pass to powershell. - Can't just use \` bcus `bash: -c: line 1: unexpected EOF while looking for matching ``'`. - Can't escape \` as it's not recognized and results in `Please ensure that the file is correctly formatted.` - It's impossible AFAIK to escape things properly & be compatible with powershell's "`" escape. ```json "watch:pwsh": "pwsh -c { wt.exe -w 'LFE' --title 'watch-dev' --suppressApplicationTitle npm run watch-dev \\`; split-pane -V --title 'watch-prod' --suppressApplicationTitle npm run watch-prod \\`; move-focus left \\`; split-pane -H --title 'watch-tsc' --suppressApplicationTitle npm run watch-tsc \\`; move-focus right \\`; split-pane -H --title 'watch-test' --suppressApplicationTitle npm run watch-test }" ``` - Because it can't be escaped properly in an npm package.json script, I instead put the command in its own file. But this also doesn't work. ex: `"watch:pwsh": "pwsh -c ./scripts/watch.ps1",` **NOTE** `pwsh -c ./scripts/watch.ps1` works fine when run from windows terminal. - `pwsh -c ./scripts/watch.ps1` **DOES NOT WORK** if run in vscode's Integrated Terminal under Bash, PWSH, or CMD - In WinTerminal using CMD this works: `powershell .\scripts\watch.ps1` - In VSCode using CMD **THIS DOES NOT WORK** - In WinTerminal using CMD this works: `wt.exe -w 'LFE' -p 'bash' --title 'watch-dev' --suppressApplicationTitle npm run watch-dev ; split-pane -H -p 'Powershell' --title 'watch-prod' --suppressApplicationTitle npm run watch-prod ^; move-focus up ; split-pane -p 'Powershell' --title 'watch-tsc' --suppressApplicationTitle npm run watch-tsc ; move-focus down ; split-pane -p 'Powershell' --title 'watch-test' --suppressApplicationTitle npm run watch-test` - In VSCode using CMD **THIS DOES NOT WORK** - In VSCode, also doesn't work if you put the command in `watch.cmd` - In WinTerminal using Bash this works: `wt.exe -w 'LFE' --title 'watch-dev' --suppressApplicationTitle npm run watch-dev \; split-pane -V --title 'watch-prod' --suppressApplicationTitle npm run watch-prod \; move-focus left \; split-pane -H --title 'watch-tsc' --suppressApplicationTitle npm run watch-tsc \; move-focus right \; split-pane -H --title 'watch-test' --suppressApplicationTitle npm run watch-test` - In VSCode using Bash **THIS DOES NOT WORK** - In VSCode, also doesn't work if you put the command in `watch.sh` <img width="2405" height="728" alt="Image" src="https://github.com/user-attachments/assets/d50d1e19-f348-45ae-8137-3c42ef496465" />
Author
Owner

@DerekZiemba commented on GitHub (Jan 12, 2026):

The same script behaves differently depending on if it was called from within vscode or if called from WindowsTerminal.

watch.ps1 has the arguments wraped 'npm run ...' in single quotes. watch2.ps1 does not wrap npm run ...

When called from VSCode.
Image

When called from WindowsTerminal.

Image
@DerekZiemba commented on GitHub (Jan 12, 2026): The same script behaves differently depending on if it was called from within vscode or if called from WindowsTerminal. `watch.ps1` has the arguments wraped `'npm run ...'` in single quotes. `watch2.ps1` does not wrap `npm run ...` When called from VSCode. <img width="1084" height="1429" alt="Image" src="https://github.com/user-attachments/assets/6b0be591-4584-486d-8727-fd1ccd285f0b" /> When called from WindowsTerminal. <img width="1503" height="1177" alt="Image" src="https://github.com/user-attachments/assets/920f2907-66f2-402f-8e9e-68f8c9218dc5" />
Author
Owner

@DerekZiemba commented on GitHub (Jan 13, 2026):

watch.ps1:

wt.exe -w 'LFE'  -d "$PWD"  --title 'watch-dev'   --suppressApplicationTitle npm run watch-dev  `; `
  split-pane -V  -d "$PWD"  --title 'watch-prod'  --suppressApplicationTitle npm run watch-prod `; `
  move-focus left   `; `
  split-pane -H  -d "$PWD"  --title 'watch-tsc'   --suppressApplicationTitle npm run watch-tsc  `; `
  move-focus right  `; `
  split-pane -H  -d "$PWD"  --title 'watch-test'  --suppressApplicationTitle npm run watch-test

watch.sh:

#!/bin/bash
d="$(cygpath -ma $PWD)"
wt.exe -w 'LFE'     -d "$d" --title 'watch-dev'   --suppressApplicationTitle  npm run watch-dev   \
  \; split-pane -V  -d "$d" --title 'watch-prod'  --suppressApplicationTitle  npm run watch-prod  \
  \; move-focus left                                                                              \
  \; split-pane -H  -d "$d" --title 'watch-tsc'   --suppressApplicationTitle  npm run watch-tsc   \
  \; move-focus right                                                                             \
  \; split-pane -H  -d "$d" --title 'watch-test'  --suppressApplicationTitle  npm run watch-test

package.json:

{
  "scripts": {
    "watch-dev": "   webpack --config webpack/webpack.dev.js   --watch",
    "watch-prod": "  webpack --config webpack/webpack.prod.js  --watch",
    "watch-tsc": "   tsc -project tsconfig.json                --watch",
    "watch-test": "  npx jest --maxWorkers=25%              --watchAll",

// These don't work
    "watch:sh": "         ./scripts/watch.sh           ",
    "watch:ps": "    pwsh ./scripts/watch.ps1          ",  // must specify pwsh if call from "ps-npm-works"

// Works if go through wt.exe
    "sh-npm-works": "wt.exe 'npm run watch:sh'         ",  // cmd must be single quoted
    "ps-npm-works": "wt.exe 'npm run watch:ps'         ",  // cmd must be single quoted

// Works if script called directly by wt.exe
    "sh-working": "  wt.exe 'sh ./scripts/watch.sh'    ",  // cmd must be single quoted
    "ps-working": "  wt.exe 'pwsh ./scripts/watch.ps1' ",  // cmd must be single quoted
  }
}

In summary, the scripts to launch WindowsTerminal only work if they themselves are called by Windows Terminal. Very Odd. And annoying because this opens up a temporary WindowsTerminal.

@DerekZiemba commented on GitHub (Jan 13, 2026): **watch.ps1:** ```ps1 wt.exe -w 'LFE' -d "$PWD" --title 'watch-dev' --suppressApplicationTitle npm run watch-dev `; ` split-pane -V -d "$PWD" --title 'watch-prod' --suppressApplicationTitle npm run watch-prod `; ` move-focus left `; ` split-pane -H -d "$PWD" --title 'watch-tsc' --suppressApplicationTitle npm run watch-tsc `; ` move-focus right `; ` split-pane -H -d "$PWD" --title 'watch-test' --suppressApplicationTitle npm run watch-test ``` **watch.sh:** ```sh #!/bin/bash d="$(cygpath -ma $PWD)" wt.exe -w 'LFE' -d "$d" --title 'watch-dev' --suppressApplicationTitle npm run watch-dev \ \; split-pane -V -d "$d" --title 'watch-prod' --suppressApplicationTitle npm run watch-prod \ \; move-focus left \ \; split-pane -H -d "$d" --title 'watch-tsc' --suppressApplicationTitle npm run watch-tsc \ \; move-focus right \ \; split-pane -H -d "$d" --title 'watch-test' --suppressApplicationTitle npm run watch-test ``` **package.json:** ```jsonc { "scripts": { "watch-dev": " webpack --config webpack/webpack.dev.js --watch", "watch-prod": " webpack --config webpack/webpack.prod.js --watch", "watch-tsc": " tsc -project tsconfig.json --watch", "watch-test": " npx jest --maxWorkers=25% --watchAll", // These don't work "watch:sh": " ./scripts/watch.sh ", "watch:ps": " pwsh ./scripts/watch.ps1 ", // must specify pwsh if call from "ps-npm-works" // Works if go through wt.exe "sh-npm-works": "wt.exe 'npm run watch:sh' ", // cmd must be single quoted "ps-npm-works": "wt.exe 'npm run watch:ps' ", // cmd must be single quoted // Works if script called directly by wt.exe "sh-working": " wt.exe 'sh ./scripts/watch.sh' ", // cmd must be single quoted "ps-working": " wt.exe 'pwsh ./scripts/watch.ps1' ", // cmd must be single quoted } } ``` In summary, the scripts to launch WindowsTerminal only work if they themselves are called by Windows Terminal. Very Odd. And annoying because this opens up a temporary WindowsTerminal.
Author
Owner

@o-sdn-o commented on GitHub (Jan 13, 2026):

When splitting the pane, the following occurs:

Image Image

_initializedTerminal becomes True immediately after checking (as if there's a race condition somewhere)
Image

@o-sdn-o commented on GitHub (Jan 13, 2026): When splitting the pane, the following occurs: <img width="995" height="459" alt="Image" src="https://github.com/user-attachments/assets/1d773be6-d778-4036-b49b-09c114f8356b" /> <img width="1594" height="997" alt="Image" src="https://github.com/user-attachments/assets/09438632-bca0-4e32-88b7-7cbc254adcea" /> _initializedTerminal becomes True immediately after checking (as if there's a race condition somewhere) <img width="1082" height="643" alt="Image" src="https://github.com/user-attachments/assets/aca0dc3f-1349-4a9b-bcf8-e5dd47f57ed1" />
Author
Owner

@DerekZiemba commented on GitHub (Jan 14, 2026):

Ahh. So it only works when launched from WindowsTerminal because WindowsTerminal is already initialized?

Whew. I began to worry I'd opened this issue & it wasn't actually a WT issue.

Also note I was able to rule out it being Machine & VSCode Profile specific yesterday by using an office machine instead of working remote on my personal machine.
There was a new peculiar behavior on the office machine though. wt.exe 'sh ./scripts/watch.sh' works on the personal machine, but not on the office machine. I didn't try the powershell variant because I had only pushed the shellscript version of what worked, so that's what I had when I pulled to that machine.

@DerekZiemba commented on GitHub (Jan 14, 2026): Ahh. So it only works when launched from WindowsTerminal because WindowsTerminal is already initialized? Whew. I began to worry I'd opened this issue & it wasn't actually a WT issue. Also note I was able to rule out it being Machine & VSCode Profile specific yesterday by using an office machine instead of working remote on my personal machine. There was a new peculiar behavior on the office machine though. `wt.exe 'sh ./scripts/watch.sh'` works on the personal machine, but not on the office machine. I didn't try the powershell variant because I had only pushed the shellscript version of what worked, so that's what I had when I pulled to that machine.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#23954