RelicRELIC
Developer copy and paste

How to copy in cmd, accurately

Copying in the Windows command line is not the same as everywhere else, mainly because Ctrl+C already has a job there. This covers the classic cmd.exe window, the newer Windows Terminal, and the piping tricks that copy a command's output straight to the clipboard.

Jordan Gibbs July 10, 2026 7 min read

The reason copy in a Windows console feels awkward is that CtrlChas meant “stop the running command” since before it meant “copy” anywhere else. The console keeps that older meaning, with one careful exception. Which window you are in changes the rules, so start by knowing which one you have: the old black cmd.exe window (technically the console host, conhost), or the modern Windows Terminal app.

Classic cmd.exe: mark, Enter, right-click

In a traditional Command Prompt window, copying is a mouse operation built on a feature called QuickEdit Mode, which is on by default in current Windows.

  • Select: click and drag the mouse across the text to highlight it.
  • Copy: press Enter, or right-click the selection. The highlighted text goes to the clipboard.
  • Paste: right-click anywhere in the window with nothing selected, and whatever is on the clipboard is typed in.

If QuickEdit is off (right-click the title bar, then Properties, then the Options tab to check), you first pick Mark from the title-bar menu before you can drag-select. With QuickEdit on, you can skip that step.

The one rule that saves grief: in the classic console, CtrlC copies only when text is currently selected. With nothing selected, CtrlC sends the break signal and cancels whatever is running. So select first, then copy, or you will kill your command instead of copying its output.

Block (rectangular) selection

Normal drag-select in the classic console grabs full lines. To select a rectangular block instead, for example one column out of aligned output, hold Alt while you drag. That gives you a box selection rather than line-by-line, which is handy for pulling a single field out of a table.

Windows Terminal: closer to normal

Windows Terminal, the app that hosts PowerShell, cmd and WSL in tabs, behaves much more like the rest of Windows. As of mid-2026, its defaults are:

  • Copy: CtrlC copies when text is selected, and still sends the interrupt when nothing is selected, so it does double duty safely. There is also an explicit CtrlShiftC that always means copy.
  • Paste: CtrlV or CtrlShiftV, or right-click.
  • Select: drag with the mouse as usual. Hold Alt while dragging for a block selection.

There is also a copyOnSelectsetting, off by default, that copies text to the clipboard the instant you finish highlighting it, no key press needed. If you like the Linux terminal habit where selecting is copying, turn it on in Settings under Interaction. Because these are configurable, someone else’s machine may not match yours, so when in doubt use the explicit CtrlShiftC and CtrlShiftV.

The Edit menu still exists

Both consoles keep the old keyboard-driven Edit menu for people who dislike relying on the mouse. Press AltSpace to open the window menu, then E for Edit, and you get Mark, Copy and Paste as menu items. Mark drops you into a keyboard selection mode where the arrow keys move the cursor and Shift plus arrows extend the selection, then Enter copies. It is slower than dragging, but it works when you have no mouse, such as over a bare Remote Desktop session.

Pasting text into a command

Pasting is usually the easy direction: right-click, or CtrlV in Windows Terminal, drops the clipboard in at the cursor as if you had typed it. Two things are worth watching.

  • Multi-line paste. If your clipboard holds several lines, the console treats each newline as if you pressed Enter, so it runs each line as a command. Windows Terminal warns you before pasting multi-line text for exactly this reason; the classic console does not, so be sure a multi-line paste is what you intend.
  • Smart quotes. Text copied out of a document or chat app can carry curly quotation marks that the shell does not recognise. If a pasted command fails with a quoting error, retype the quotes by hand.

Copy a command’s output with clip

Selecting text with the mouse is fine for a line or two. When you want the entire output of a command on the clipboard, pipe it to the built-in clip command instead. It works in both cmd and PowerShell.

Pipe output straight to the clipboard
dir | clip
ipconfig | clip
type notes.txt | clip

After that, paste anywhere with the usual CtrlV. This is far more reliable than hand-selecting long output, and it is the standard way to grab a full directory listing or a config dump. Copying a file’s full path is a related job; we cover the shortcuts for that in how to copy a file path.

One gotcha with clip: it appends a trailing newline. Paste into a shell prompt and that newline can execute the line before you are ready. When you need the value exactly, with no stray newline, use PowerShell’s Set-Clipboard instead, shown below.

PowerShell: Get-Clipboard and Set-Clipboard

PowerShell has proper clipboard cmdlets, which are cleaner than piping to clip and let you read the clipboard back into a variable.

PowerShell clipboard cmdlets
# put text on the clipboard (no trailing newline)
"hello world" | Set-Clipboard

# copy a command's full output
Get-ChildItem | Set-Clipboard

# read the clipboard back into the shell
Get-Clipboard

# capture it into a variable to work with
$pasted = Get-Clipboard

Set-Clipboard replaces the clipboard, and Get-Clipboard returns what is on it as text you can pipe onward. This pair is the tidiest way to move data between a script and whatever you paste into next. If you script things that generate identifiers, our UUID generator is a quick browser tool for a one-off id when you do not want to remember the exact cmdlet.

When the output scrolls off the screen

Hand-selecting with the mouse only reaches what is visible in the scrollback buffer, and a long build log or a big directory can run past the top of it. This is the strongest reason to pipe to cliprather than drag-select: piping captures the command’s complete output regardless of how much scrolled by. If you do want to scroll and select in the classic console, the buffer’s height is set under Properties, then the Layout tab, where a larger screen-buffer height keeps more lines available to copy.

You can also load a file straight onto the clipboard without opening it, which is useful for grabbing a config or a key file to paste elsewhere:

Load a file onto the clipboard
clip < config.txt
Get-Content config.txt | Set-Clipboard

Copy to the clipboard versus save to a file

clip and Set-Clipboard put output on the clipboard so you can paste it once. If you want to keep the output, redirect it to a file instead, and the two are not mutually exclusive.

Clipboard vs file
dir | clip            # to the clipboard, paste once
dir > listing.txt     # to a file, kept on disk
dir >> listing.txt    # append to the file instead of overwriting

Use the clipboard for a quick hand-off into a chat message or a ticket, and a file when you need the output to still be there tomorrow.

Copying in the console, at a glance

  • Classic cmd: drag to select, Enter or right-click to copy, right-click to paste.
  • CtrlC copies only with a selection; with nothing selected it cancels the command.
  • Windows Terminal: CtrlShiftC and CtrlShiftV always mean copy and paste.
  • Pipe to clip, or use Set-Clipboard, to copy a whole command’s output.
  • Hold Alt while dragging for a rectangular block selection.

This was the Windows side. The macOS and Linux terminals, plus tmux, Vim and copying over SSH, live in the companion guide, how to copy and paste in the terminal. And if copy and paste has stopped working in your console entirely, the checklist in copy and paste not working covers the usual causes.

Written by
Jordan GibbsFounder, Relic

Jordan Gibbs is the founder of Relic, an end-to-end encrypted, permanent, searchable memory for everything you copy. He writes widely about AI, agents, and practical tooling on Medium, where he is read by tens of thousands, and builds privacy-first software. Here he covers how everyday tools like the clipboard actually work, and how to use them without handing your data to someone else.

MediumGitHubLinkedIn
Part of
Developer copy and paste
Keep reading
Pillar·8 min

How to copy and paste in the terminal

Ctrl C cancels a command in the terminal, so copy and paste works differently there. Getting it right in Windows Terminal, macOS, Linux, tmux, Vim and over SSH.

Read
7 min

What is a UUID?

A UUID is a 128-bit value designed to be unique without any central authority handing it out. What they are, how the versions differ, and when to reach for one.

Read
7 min

What is a JWT token?

A JWT packs a user's identity into a signed, self-contained token. What the three parts hold, how the signature works, and what a JWT does and does not protect.

Read
developerhow-towindows