You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So, if I'm reading this correctly, what you're really looking for is the sendInput action, but as a subcommand on the commandline? So that when you already have an existing terminal instance, you could do
wt -w send-input ls
to send "ls" to the active pane. That makes sense to me. It's something we've been back and forth on in the past - I've been a little hesitant to allow other processes to "inject" input into terminal instances like this. That being said, we're not really pursuing mixed elevation anymore, so now I'm less worried about this.
What I am worried about is how we encode special characters. Not all shells support multi-line input, so putting a raw \n into the input might be tricky. It's easier to encode in json where you can just literally say "ls\n". A flag to say "please follow this input string with a \n" isn't a terrible idea, but then what if you want multiple commands? What if you want an arrow key? So we'd need to have a good way of encoding escape character in the input (regardless of shell).
changed the title [-]windows terminal preview - can NOT execute command after tab focus[/-][+]Add support for `send-input` subcommand[/+]on Mar 3, 2021
...so perhaps accepting "multiline / etc input" in a smart way is yet another feature? and we could try how idea is working out in a wild.
to add more context of my use case
i'd like to have one monitor of multiple opened terminals only and pushing to chosen one with my ide shortcuts from another monitor
until remote control was released my scenario was
1. create command in editor (as i usually have there more context than terminal history)
2. select
3. copy
4. change to desired terminal window (mostly with alt+tab 1-n times until got wanted one )
5. select desired tab
6. Paste
7. Go back (mostly with alt+tab 1-n times until got wanted one)
with remote control currently i have
1. create command in editor (as i usually have there more context than terminal history)
2. select
3. copy
4. with single shortcut -> select desired tab with know window id and tab index
5. -
6. Paste
7. Go back (mostly with alt+tab 1-n times until got wanted one)
it's better but i need
1. create command in editor (as i usually have there more context than terminal history)
2. select
3. with single shortcut -> select desired tab with know window id and tab index and execute my selected string there
4. -
5. -
6. -
7. -
there are also scenarios when command is derived entirely from context so if you'd create shortcut for this in your IDE you could
1. -
2. -
3. with single shortcut -> select desired tab with know window id and tab index and execute command is derived entirely from context there
4. -
5. -
6. -
7. -
i hope it's worth pursuing
also
it helps alot with work ergonomic ( and wrist pain ;) )
I'm not terribly concerned about multiline input, since you can stack multiple send-input commands to achieve the same goal. Perhaps it is a little less graceful, but it would allow for behavior similar to the current split-pane [commandline] syntax where \n is implied. The caller has to consider the requirements for whether the profile accepts any special characters sent.
I don't really see a use case for sending arrow keys as input (famous last words perhaps). My thinking is that this extends the precedent for functionality set by split-pane [commandline] for a lot of added flexibility.
This feature would be similar to tmux's send-keys action. It could be used in several ways, but I use it to send text from Vim to a REPL, basically setting up an ad-hoc IDE. (Yes Vim has embedded terminal now, but it cannot really replace a fully-functioning terminal.)
Wezterm also has a similar feature. It's called send-text.
Nope. We'll make sure to update this thread when there is. In the meantime, might I recommend the Subscribe button?
That way you'll be notified of any updates to this thread, without needlessly pinging everyone on this thread ☺️
I'm also still not sure how confident I feel about the ability for arbitrary exes to send arbitrary keystrokes to random shells. Maybe I'd feel more confident if it was an opt-in thing. Like, you need to turn on a special setting first to say "yep, I'm gonna do some scripting now" - though, if it was just in the settings.json, there's literally nothing that prevents malicious.exe from just changing the settings file itself.
I have really enjoyed working with WSL2 as a combination of Windows and Linux, but not being able to programmatically control the terminal app itself (including sending arbitrary input to it) feels limiting right now in a time of automation.
to send "ls" to the active pane. That makes sense to me. It's something we've been back and forth on in the past - I've been a little hesitant to allow other processes to "inject" input into terminal instances like this. That being said, we're not really pursuing mixed elevation anymore, so now I'm less worried about this.
Since this message was written, we actually did pursue mixed elevation. I have not stopped worrying about the security risk this opens up, and so I am going to move this to the rejected state. Sorry, and thanks.
Activity
zadjii-msft commentedon Mar 3, 2021
So, if I'm reading this correctly, what you're really looking for is the
sendInputaction, but as a subcommand on the commandline? So that when you already have an existing terminal instance, you could doto send "ls" to the active pane. That makes sense to me. It's something we've been back and forth on in the past - I've been a little hesitant to allow other processes to "inject" input into terminal instances like this. That being said, we're not really pursuing mixed elevation anymore, so now I'm less worried about this.
What I am worried about is how we encode special characters. Not all shells support multi-line input, so putting a raw
\ninto the input might be tricky. It's easier to encode in json where you can just literally say"ls\n". A flag to say "please follow this input string with a\n" isn't a terrible idea, but then what if you want multiple commands? What if you want an arrow key? So we'd need to have a good way of encoding escape character in the input (regardless of shell).[-]windows terminal preview - can NOT execute command after tab focus[/-][+]Add support for `send-input` subcommand[/+]ngmariusz commentedon Mar 4, 2021
Yes, thank you "send-input" is much better name;
As i understand encoding/escaping is well know problem
no long ago i was trying this ${selectedText} in vscode tasks ( https://code.visualstudio.com/docs/editor/variables-reference )
and it bited me couple of times but eventually i figured that out, we are developers after all ;)
...so perhaps accepting "multiline / etc input" in a smart way is yet another feature? and we could try how idea is working out in a wild.
to add more context of my use case
i'd like to have one monitor of multiple opened terminals only and pushing to chosen one with my ide shortcuts from another monitor
until remote control was released my scenario was
with remote control currently i have
it's better but i need
there are also scenarios when command is derived entirely from context so if you'd create shortcut for this in your IDE you could
i hope it's worth pursuing
also
it helps alot with work ergonomic ( and wrist pain ;) )
joswr1ght commentedon Feb 14, 2022
I'm not terribly concerned about multiline input, since you can stack multiple
send-inputcommands to achieve the same goal. Perhaps it is a little less graceful, but it would allow for behavior similar to the currentsplit-pane [commandline]syntax where\nis implied. The caller has to consider the requirements for whether the profile accepts any special characters sent.I don't really see a use case for sending arrow keys as input (famous last words perhaps). My thinking is that this extends the precedent for functionality set by
split-pane [commandline]for a lot of added flexibility.3N4N commentedon Jul 18, 2023
This feature would be similar to tmux's
send-keysaction. It could be used in several ways, but I use it to send text from Vim to a REPL, basically setting up an ad-hoc IDE. (Yes Vim has embedded terminal now, but it cannot really replace a fully-functioning terminal.)Wezterm also has a similar feature. It's called
send-text.noheromen commentedon Oct 12, 2023
Any progress on this feature? I would like to have it too. Thanks
zadjii-msft commentedon Oct 12, 2023
Nope. We'll make sure to update this thread when there is. In the meantime, might I recommend the Subscribe button?

☺️
That way you'll be notified of any updates to this thread, without needlessly pinging everyone on this thread
I'm also still not sure how confident I feel about the ability for arbitrary exes to send arbitrary keystrokes to random shells. Maybe I'd feel more confident if it was an opt-in thing. Like, you need to turn on a special setting first to say "yep, I'm gonna do some scripting now" - though, if it was just in the settings.json, there's literally nothing that prevents
malicious.exefrom just changing the settings file itself.einarpersson commentedon Jan 24, 2024
I have really enjoyed working with WSL2 as a combination of Windows and Linux, but not being able to programmatically control the terminal app itself (including sending arbitrary input to it) feels limiting right now in a time of automation.
laffo16 commentedon Apr 12, 2026
I implemented this locally on top of current
mainand opened a draft PR from my fork: #20106.The patch adds:
wt send-input <input...>--enter--enter-delay-ms <ms>--activateIt supports existing-window automation flows like:
wt -w 0 send-input "hello"wt -w 0 focus-tab -t 1 ; send-input --enter "echo TAB2_OK"For existing-window
send-input, background delivery is the default;--activateopts back into the normal summon behavior.I also kept structural chains like
new-tab ; send-inputandsplit-pane ; send-inputon the existing activation path.DHowett commentedon Apr 13, 2026
Since this message was written, we actually did pursue mixed elevation. I have not stopped worrying about the security risk this opens up, and so I am going to move this to the rejected state. Sorry, and thanks.
docs(adr-013): Phase 5 — ADR-013 v1.4 + matrix §3.1/§4.3 + CHANGELOG
docs(adr-014): Round 1 Opus phase-boundary review findings apply (P1×…
docs(adr-014): Draft v1 — Cooperative in-pane bridge for WT (named pi…
docs(adr-014): Draft v1 — Cooperative in-pane bridge for WT (named pi…
docs(adr-014): Draft v1 — Cooperative in-pane bridge for WT (named pi…