In the original PowerShell console it was possible to paste and edit multiline commands before executing it
For example this multiline script:
Write-Host "===== 1 ====="
Write-Host "===== 2 ====="
Write-Host "===== 3 ====="
Write-Host "===== 4 ====="
results in the following output

Unfortunately, in the Windows Terminal pasting of the same script results in a very different output

Any ideas how to "fix" the multiline pasting in the Windows Terminal?
The solution for me was to just comment out a line in the terminal setting.json with { "command": "paste", "keys": "ctrl+v" }

And then it works - here the expected output

Edit:
After uncommenting the Ctrl+V chord in the settings.json, the paste functionality is ensured by the PSReadLine module (see Get-PSReadLineKeyHandler -Chord ctrl+v) but Ctrl+V will stop to work in other shells - use Shift+Ctr+V instead
@honzajscz's solution is still correct in spirit, however the structure of the Windows Terminal settings.json file has changed since 2021.
Commenting out the line "keys": "ctrl+v" as shown below worked for me. This is still accurate as of 2025-11-25, for Windows Terminal production branch, version 1.23.12811.0.

Here is some PowerShell which will perform the necessary modification to your settings.json file. This is useful for me because I'm often launching Windows Terminal on freshly reimaged test VMs and sometimes want to paste multiline code without having to manually perform the JSON modification every time.
# The settings.json path may need to be modified for different versions of Windows Terminal (specifically for the Preview branch)
$path = "$($env:LocalAppData)\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json"
# Grab the content of the settings.json file
$content = Get-Content $path | Out-String
# Insert commenting characters before the target line
$target = '"keys": "ctrl+v"'
$replacement = "//$target"
$newContent = $content.Replace($target, $replacement)
# Overwrite the settings.json file with the modified content
$newContent | Set-Content $path
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With