Monday, July 18, 2011

Windows Command Line Cut & Paste Rant

Just a quick rant this week. When selecting text in the windows command console, why does it do a "block" mark rather than a line based mark?!?! In every other text based environment I've used, including Windows Notepad and MS Word, if you start highlighting text in the middle of one line and move down to the middle of the next line it select the end of the first line and the beginning of the next line.  i.e. all the text that starts where you started the mark and ends where you ended the mark. For some reason the Windows Command shell only marks the text that is actually in the box, i.e. a couple characters in the middle of both lines.

Is there a time that this behavior is useful? If you know, please share it with me.

For me, I often want to copy either a long command line I ran, or the output of a command, to put in an email, IM, a wiki, or even to paste into another terminal to run. But if the line is wrapped, then to make sure I get everything I want, I have to also copy the command prompt. This means I have to add an intermediate step of editing my selection before I can send it.

What's even more bizzarre to me, is that in searching on the web, I can't even find any other comments about this behavior. Nor can I find a way to change this. Am I the only one who finds this annoying? More importantly, does anyone know how to change this behavior?

(I know, I know. I shouldn't be using Windows, and I shouldn't be cutting and pasting. Well, I have to admit that I sometimes do both, and I was doing a lot of both this past week.)


David Barr said...

While I agree that it is really annoying, there are times when I am extracting columnar data, such as file names and sizes from "dir" output or "ps" (run in powershell). On the whole, I'd much rather the default for the command shell not be column copy.

Anonymous said...

for something this weird and inconsistent, there has to be some historical reason for it. Unfortunately, I don't know what that historical reason is. ms-windows goes back to 1985 but I never used anything before windows3.0.

Michael Haddox-Schatz said...

David, that makes sense for a use of column copy. I could even live with it being a default as long as I can change it to do line copies. Any idea how to change that? Or am I just out of luck?

Anonymous said...

I found this rant when looking up the exact same issue. It does seem strange that there is a dearth of complaints about this action--I find it almost unusable to do copy&paste operations in a window's CLI.

In addition, CLI's are supposed to be mouse-free anyway, so why this clunky method? Why does no one else seem to care?