Copy and paste in Windows PowerShell
How do I effectively copy and paste input and output in the Windows PowerShell?
- To select text in PowerShell with the mouse, just select it as usual.
- To copy the selected text to the clipboard you have to either hit Enter, or right-click.
- To paste into the PowerShell window, right click.
keyboard
- Paste: alt+[space], e, p
Note: In current versions of Windows 10, Ctrl+C, and Ctrl+V work as expected.
(Elaborating on the answer of Ƭᴇcʜιᴇ007 and Val)
Mouse
Select/Mark: Press left mouse button, drag, release.
Copy: Right-click.
Paste: With content in the clipboard, right-click.
Keyboard
Activate Mark: Alt + Space > e > k.
Select a Block: Navigate (arrow keys, Page-down, Page-up, End, Pos1) to the upper left corner of the block, press and hold Shift, navigate to the lower right corner, release Shift.
Copy: With a block selected, either hit Enter or Alt + Space > e > y.
Paste: With content in the clipboard, Alt + Space > e > p.
Depends on which PowerShell you are using. With the newer PowerGUI Script Editor or with the PowerShell ISE (integrated scripting environment) cut/paste seems to work better:
- To cut drag the mouse across text to select, then ^C or right click to copy.
- To paste use ^V
With the older PowerShell:
- To cut drag the mouse across text to select, then enter to copy.
- You can sometimes hit ^C to copy but it does not seem to ALWAYS work.
- You can also drag to select then right click in the top window pane bar and select Edit | copy.
- To paste right click.
Good links for people learning PowerShell::
-
The best PowerShell tutorial I've found so far is here. It goes into quite a bit of description of the command line. Sadly some of the cool stuff in the original PowerShell appears to be broken in ISE, like ctrl-home for example, to delete to start of line.
-
Some differences between these two PowerShells is here.
As of Windows 10, Ctrl + C works for copying the text & Ctrl + V works for paste. You can also select the data using Shift + Arrow(Left/Right).
The standard console can be used in Windows 10 — the PowerShell ISE is still available but not required for copy/paste support.
As of PowerShell Core 6, shortcut to copy and paste is Ctrl+Shift+C and Ctrl+Shift+V and is toggleable in the settings: