Copy multiple lines from Windows Command prompt without forced newlines
The Windows Command Prompt is notoriously broken in this aspect. It is not possible to get the Linux Terminal behavior (at least for pre-Windows 10 according to Luu's comment).
However, there is an obscure feature in cmd.exe which helps: Holding down shift when right clicking into the selected area (to copy) will remove ALL newlines in the copied text.
If you want to select a single long command line (spanning multiple terminal lines) this does what you want. However, it will always remove all newlines, so it is not possible to select multiple command lines (or a script) in a sensible way.
Detailled procedure:
- Select long command line using the left mouse button
- Press down shift
- Right click into the selected area (to copy)
- Release shift
- Now the selected text is in the copy buffer without newlines and you can for example paste it into cmd.exe again using the right mouse button
Another option is to open the context menu of the console window's title bar, go to Properties and make the screen buffer's width large enough that things don't wrap. (9999 appears to be the maximum value.)
If you're having to do this a lot, you can change the option in Defaults instead of Properties.
Of course, this method breaks down if the lines are longer than 9999 characters.