Command Prompt is executing commands without me pressing enter.

Discussion in 'Windows 7' started by andrew-s, May 19, 2024.

  1. andrew-s

    andrew-s MDL Novice

    Sep 18, 2009
    39
    16
    0
    Hello folks, so I pasted a command in a command prompt and the command immediately executed without me pressing the enter key.
    On another machine the same command waits for me to press enter.
    I'm clueless.
    Would appreciate advice.
    Thanks.
     
  2. Carlos Detweiller

    Carlos Detweiller Emperor of Ice-Cream

    Dec 21, 2012
    6,801
    7,771
    210
    If the pasted string contains the line ending characters (invisible), that is interpreted as pressing Return/Enter.

    If you mark the line from begin to end (same line), the characters are not included.
    But if you mark the line from the begin to the begin of the next line, they are included.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Dark Dinosaur

    Dark Dinosaur X Æ A-12

    Feb 2, 2011
    4,189
    6,018
    150
    What's I like to do
    Copy paste into blank notepad window
    And copy again from the notepad
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. Carlos Detweiller

    Carlos Detweiller Emperor of Ice-Cream

    Dec 21, 2012
    6,801
    7,771
    210
    You could use Notepad++ and enable displaying the CR+LF characters. Then, you'll see if they are included and avoid to mark them.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. andrew-s

    andrew-s MDL Novice

    Sep 18, 2009
    39
    16
    0
    I copied and pasted into notepad and edited then pasted into an email which I sent to another laptop and pasted into cmd and got the dissimilar results.
    I'll check again tommorrow maybe.
     
  6. acer-5100

    acer-5100 MDL Guru

    Dec 8, 2018
    4,003
    2,925
    150
    @andrew-s


    You just copied the last character in one case and you didn't in the other. It happens frequently even to experienced users.

    Just start selecting from the end of the last line, not from the beginning of the following (blank) one, if you want to avoid to copy the return character together with the text.
     
  7. LiteOS

    LiteOS Windowizer

    Mar 7, 2014
    2,346
    1,051
    90
    copying empty line is parsed as enter in cmd.exe
     
  8. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    17,281
    91,251
    340
    It's the CR symbol actually

    if you copied empty line from Unix line-ending (LF) file, it's not parsed as enter