Press Ctrl+V to paste in PowerShell, or right-click the window. Shift+Insert works too. In a script, read the clipboard with Get-Clipboard and fill it with Set-Clipboard:
Set-Clipboard -Value 'Maria Lopez, Austin, TX'
Get-Clipboard
In this tutorial, I’ll show you how to paste in PowerShell with every shortcut, copy console output, and fix the paste problems I hit in PowerShell 7 and Windows PowerShell 5.1.
Keyboard shortcuts to copy and paste in PowerShell
Both shells use PSReadLine for the command line, and Windows Terminal adds its own keys. Here’s what works where:
| Action | Windows Terminal | Classic console window |
|---|---|---|
| Paste | Ctrl+V, Ctrl+Shift+V, Shift+Insert | Ctrl+V, Shift+Insert (PSReadLine) |
| Paste with the mouse | Right-click (when nothing is selected) | Right-click (QuickEdit Mode on) |
| Copy a selection | Ctrl+C, Ctrl+Shift+C, Ctrl+Insert, Enter | Enter or right-click |
| Copy the typed command | Select it with Shift+arrows, then Ctrl+C | Same (PSReadLine) |
You can confirm the PSReadLine bindings on your own PC with Get-PSReadLineKeyHandler:
Get-PSReadLineKeyHandler -Bound |
Where-Object Function -in 'Paste', 'Copy', 'CopyOrCancelLine', 'Cut' |
ForEach-Object { '{0,-17} {1}' -f $_.Function, $_.Key }
Output:
Copy Ctrl+C
CopyOrCancelLine Ctrl+c
Cut Ctrl+x
Paste Ctrl+v
Paste Shift+Insert
I got the same list in both versions. Not sure which app hosts your shell? See Windows Terminal vs PowerShell.
How do I copy text from the PowerShell window?
Drag the mouse over the text, then press Enter or Ctrl+C. Hold Alt while dragging to select a block, which is handy for one column of a Format-Table output.
Careful with Ctrl+C: when nothing is selected, it cancels the current line instead of copying. In Windows Terminal, turn on copyOnSelect if you want a selection copied the moment you release the mouse.
Why does pasted code run right away?
Each newline in pasted text acts like pressing Enter. Ctrl+V hands the whole block to PSReadLine at once, so PowerShell parses it as one input.
Right-click paste in the classic console types the text one character at a time, so each line runs as soon as its newline arrives.
Windows Terminal shows a warning before a multi-line paste (multiLinePasteWarning). To build a multi-line command yourself without running it, press Shift+Enter between lines.
If you’d rather paste one long line, join the multiline string into a single line first.
Paste clipboard text into a script with Get-Clipboard
Get-Clipboard returns the clipboard text. Multi-line text comes back as an array, one string per line, and -Raw keeps it as one string:
Set-Clipboard -Value 'Austin', 'Denver', 'Seattle'
$lines = Get-Clipboard
"Lines: $($lines.Count), first: $($lines[0])"
$raw = Get-Clipboard -Raw
"Raw: one $($raw.GetType().Name) of $($raw.Length) characters"
Output:
Lines: 3, first: Austin
Raw: one String of 23 characters
Three lines became three strings, while the raw copy is a single 23-character string with the line breaks inside. Use the array to loop over lines, or split the raw string your own way.
Copy PowerShell output to the clipboard with Set-Clipboard
Set-Clipboard replaces the clipboard, and -Append adds a new line instead:
Set-Clipboard -Value 'Tom Baker'
Set-Clipboard -Value 'Dana Reyes' -Append
Get-Clipboard
Output:
Tom Baker
Dana Reyes
Piping objects is where people get stuck. Set-Clipboard turns each object into text, so you get hashtable-style strings. Convert them first:
$team = [pscustomobject]@{ Name = 'Maria Lopez'; City = 'Austin' },
[pscustomobject]@{ Name = 'Tom Baker'; City = 'Denver' }
$team | Set-Clipboard
Get-Clipboard
'--- as CSV ---'
$team | ConvertTo-Csv -NoTypeInformation | Set-Clipboard
Get-Clipboard
Output:
<