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.
1 Answer
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:
- Right click on the title bar at the top of the console window.
Click Properties.
Click the Options tab.
Uncheck Quick Edit Mode.
Once you've made this change, you can no longer easily copy from the console. In order to copy you will need to:
-
Thanks. But what does the script doing while console is in copy mode? Is it continuing or it is stopped at all?– ČamoMay 30, 2019 at 15:30
-
It seems to depend on what you're running.
ping
androbocopy
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. May 30, 2019 at 15:49 -
It depends on script and things. If print operation is blocking - script stops. You may check that trying to print timestamps sequentially– MaximusMay 30, 2019 at 15:50
-
While the user is interacting with the console's output in the UI any code that tries to write to the console's output stream will be blocked. Aug 6, 2021 at 13:14