in reply to [SOLVED] copying multiline code from cmd.exe with reasonable newlines

Pardon my ignorance, but why would you even use <shift enter>, what is the benefit?

A puzzled Linux user

  • Comment on Re: [SOLVED] copying multiline code from cmd.exe with reasonable newlines

Replies are listed 'Best First'.
Re^2: [SOLVED] copying multiline code from cmd.exe with reasonable newlines
by LanX (Saint) on Jun 02, 2017 at 23:12 UTC
    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.