Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to select text across lines as a single line in the Windows command prompt? For example, selecting this rectangular selection:

alt text

puts two separate lines in the clipboard, even though the lines are contiguous. Doing the same thing in xterm on Linux will put one line on the clipboard, which is what I want. Is there a way to get cmd.exe to behave like xterm?

share|improve this question
Alternatives:… – hyperslug Jul 25 '10 at 23:03
up vote 3 down vote accepted

There is a way to select the line of text as one single line. Before right clicking on the white highlighted area hold down the shift key, then right click the white area. This will remove the carriage returns.

share|improve this answer
Finally, an acceptable answer! It only took 5 years! – Steven May 20 '15 at 22:46

You can export to a text file and then do as you like. when you do your command, run it as:

[executable] >textfile.txt

This will output to the specified file anything the exe would output to the screen.

share|improve this answer

use a terminal such as Console2 to run your cmd.exe (or powershell.exe) from. such terminals offer (among other things) superior selecting mechanisms.

share|improve this answer

Windows' cmd application is a very very basic tool. It's not intended to be used like the power-user's do-all swiss army knife that is the Linux terminal.

So basically, no, you can't grab multiline selects as a single line. Sorry.

share|improve this answer
Well.. Copy them, and format them in 1-2 second with Notepad++. Hard-stuff if you are a so-called "poweruser". – Shiki Jul 26 '10 at 11:24
I wouldn't call the cmd a "very very basic tool"...I'd call it crippled...especially in comparison with Linux Shells. – Bobby Jul 26 '10 at 11:26
This doesn't excuse cmd's awkward selection behavior. There are no other programs that I know which select text as a rectangular area rather than a string of characters, no matter how basic. – Lèse majesté Apr 3 '12 at 2:03

Installing cygwin will solve all your problems:)

share|improve this answer
and introduce new ones :) – akira Jul 28 '10 at 13:04
copy style from cygwin is exactly the same AFAIK... – Betlista Jan 28 '13 at 14:13

There's no way to do that using cmd.exe, but you can use a console emulator. I am specially fond of ConEmu, which gives you several enhancements such as:

  • Better text selection
  • Multiple consoles in tabs
  • Resizable windows
  • Fullscreen mode
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .