1

I have a script that does a multitude of actions, with lots of echoes. When clicking into the CMD prompt, mark mode is activated and the script is blocked from writing to the terminal until I exit mark mode or perform any actions that would otherwise disable mark mode (like right-click).

There are several non-programmatic solutions to this problem involving disabling quick edit mode for the CMD.

Example/pertinent batch file:

:test
echo %0
goto test

Clicking into the CMD while this is executing will cause the output to stop, whilst right-clicking within the window (or otherwise unmarking the selection) will cause the output to continue.

However, I would like to avoid/workaround this issue entirely via my script, so I do not need to modify the functionality of my CMD otherwise.

How can I write to the console, and ensure my program will continue regardless of marking inside the console?

Can I direct my output to the window in a way that marking/making a selection in the window will not block STDOUT? Ideally the echo will function while the console is marked.

I've seen someone direct their echo to > nul, but that seems to be preventing writing to the console entirely and does not solve the root of the issue.

Community
  • 1
  • 1
Sam
  • 95
  • 1
  • 8
  • to disable `quick edit`, right click on command prompt title bar, select properties, navigate to the options tab and deselect quick edit. – T3RR0R Jan 28 '22 at 20:12
  • While in mark mode, stdout blocks. There's not much you can do about that from a batch file, other languages can use a background thread or process, like [this in python](https://gist.github.com/Q726kbXuN/c1054cfcd9c8d2faa87760c9ba398229), to queue up output. – Anon Coward Jan 28 '22 at 20:16
  • Quick Edit mode means you can select on a right click and slight drag. Turn off in the Command Prompt's Properties. If you want to turn it off by script see https://winsourcecode.blogspot.com/2020/08/quickeditexe-turns-on-or-off-quick-edit.html. Note with Quick Edit off the user can still right click - Edit - Mark. – KL-1 Jan 29 '22 at 05:44

0 Answers0