Well I understand your bewilderment better than I understand cmd.exe, but let me try: ;-)

First of all copying is totally different to a xterm.

In xterm you have a one dimensional copy, the complete lines between start and end-mark are copied and no newlines are included between automatically wrapped-over lines.

In cmd.exe you have only (AFAIK) a rectangular copy. So if you want to copy a command which was wrapped over you need to start your selection to the very left and span to the right edge. And if you do [ENTER] instead of [SHIFT ENTER] you'd get newlines included at every right end, even if it was an automatic wrap in the middle of a word.

like

D:\Users\lanx>perl -e "$_='x';print;print;print;print;print;print;prin +t;print;print;print;print;print;print;pri nt;print" xxxxxxxxxxxxxxx

Of course you can't really copy long commands with random newlines and expect to execute them right away.

That's why you quickly get into the habit to use [SHIFT ENTER] and no newlines are included.

D:\Users\lanx>perl -e "$_='x';print;print;print;print;print;print;prin +t;print;print;print;print;print;print;print;print"

Colleagues showed me once [SHIFT ENTER] and only [SHIFT ENTER] and I stuck with this.

cmd.exe is - from what I know - not very short cut friendly.

You need to mix mouse and and keyboard actions and are happy for any help.

I suppose power-shell is better in this respect, I'll try it out one day.

HTH explaining the confusion a bit! :)

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

PS: in hindsight it seems very off-toppic, but I wasn't sure if some HTML voodoo was interfering here.


In reply to Re^2: [SOLVED] copying multiline code from cmd.exe with reasonable newlines by LanX
in thread [SOLVED] copying multiline code from cmd.exe with reasonable newlines by LanX

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.