Windows 10 console stops running if I click in the console window

4

I have a PHP script which runs via Windows Task Scheduler. When it starts it automatically opens a console window where the script writes status messages. If I click on this window it stops the script running. The window is still opened but it seems the script does not work. The window does not disappear. I don't understand why it happens. How can I see any errors from the script or what it is doing.

Čamo

Posted 2019-05-30T11:03:40.403

Reputation: 143

Answers

4

The Windows 10 command prompt pauses when you click so that you can copy and paste text without that text changing or moving. You can escape this copy mode by simply right clicking in the console window.

Whether or not this will pause the commands running in the command prompt depends on the commands you're running. Generally it seems that commands writing output to the console will pause, whereas commands writing output to a log file will not.

To stop the command prompt from pausing:

  1. Right click on the title bar at the top of the console window.
  2. Click Properties.

    enter image description here

  3. Click the Options tab.

  4. Uncheck Quick Edit Mode.

    enter image description here

Once you've made this change, you can no longer easily copy from the console. In order to copy you will need to:

  1. Right click on the title bar at the top of the console window.
  2. Highlight Edit.
  3. Click Mark.

    enter image description here

  4. Highlight your selection.

  5. Right click to copy.

Worthwelle

Posted 2019-05-30T11:03:40.403

Reputation: 3 556

Thanks. But what does the script doing while console is in copy mode? Is it continuing or it is stopped at all? – Čamo – 2019-05-30T15:30:18.740

It seems to depend on what you're running. ping and robocopy both pause if the output is going to the console, but continue if the output is piped to a log file. I'm not sure if that applies to PHP scripts since I don't have it available on this computer to test. – Worthwelle – 2019-05-30T15:49:32.617

It depends on script and things. If print operation is blocking - script stops. You may check that trying to print timestamps sequentially – Maximus – 2019-05-30T15:50:24.530