Reproduce multi-line paste handling from Powershell host #10846

Open
opened 2026-01-31 02:31:51 +00:00 by claunia · 0 comments
Owner

Originally created by @nixtar on GitHub (Oct 1, 2020).

Description of the new feature/enhancement

In powershell.exe you can paste multiple lines using ctrl+v and the shell will give you the lines in an editable fashion, almost as if ` was appended to each line.
Currently Windows Terminal handles pasting with ctrl+v with the same behaviour as pasting using right click in powershell.exe and executes each line separately.

EG:
If you copy and paste using ctrl+v the following block into powershell.exe it gets handled as a single block and you can use arrow keys to move up and change the lines.

$a = "Foo"
$b = "Bar"
Write-Host "$a $b"

to powershell.exe:

PS D:\> $a = "Foo"
>> $b = "Bar"
>> Write-Host "$a $b"

To Windows Terminal:

PS D:\> $a = "Foo"
PS D:\> $b = "Bar"
PS D:\> Write-Host "$a $b"

This comes in handy for me when copying snippets of powershell from other projects or from websites and I need to adjust them slightly without needing to first paste into Notepad, VSCode or ISE to edit.

Perhaps a setting to toggle this kind of pasting behaviour in the profile or a multiline paste command to handle this situation?
It would also make pasting multiple lines more "safe" as you need to hit return to execute the lines.

Originally created by @nixtar on GitHub (Oct 1, 2020). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> # Description of the new feature/enhancement In powershell.exe you can paste multiple lines using ctrl+v and the shell will give you the lines in an editable fashion, almost as if ` was appended to each line. Currently Windows Terminal handles pasting with ctrl+v with the same behaviour as pasting using right click in powershell.exe and executes each line separately. EG: If you copy and paste using ctrl+v the following block into powershell.exe it gets handled as a single block and you can use arrow keys to move up and change the lines. ```powershell $a = "Foo" $b = "Bar" Write-Host "$a $b" ``` to powershell.exe: ```none PS D:\> $a = "Foo" >> $b = "Bar" >> Write-Host "$a $b" ``` To Windows Terminal: ```none PS D:\> $a = "Foo" PS D:\> $b = "Bar" PS D:\> Write-Host "$a $b" ``` This comes in handy for me when copying snippets of powershell from other projects or from websites and I need to adjust them slightly without needing to first paste into Notepad, VSCode or ISE to edit. Perhaps a setting to toggle this kind of pasting behaviour in the profile or a multiline paste command to handle this situation? It would also make pasting multiple lines more "safe" as you need to hit return to execute the lines.
claunia added the Issue-QuestionNeeds-Tag-FixResolution-Answered labels 2026-01-31 02:31:51 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#10846