5

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?

1
4

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.

1
  • That trick works as well when you press Enter to copy the selection: Shift + Enter removes the CRLFs. =) – Bowi Jul 18 '19 at 6:59
4

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.

2

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

1

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.

3
  • Well.. Copy them, and format them in 1-2 second with Notepad++. Hard-stuff if you are a so-called "poweruser". – Apache Jul 26 '10 at 11:24
  • 1
    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
  • 1
    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
0

Installing cygwin will solve all your problems:)

2
  • 6
    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
0

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

  • Better text selection
  • Multiple consoles in tabs
  • Resizable windows
  • Fullscreen mode
1
  • there's a way to that using cmd.exe as of now – phuclv Oct 13 '17 at 10:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.