Auto Yes by Ctrl+C on Terminate batch job (Y/N)? on Windows #450
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
xlink microsoft/terminal#217
The question is not for me, but it also concerns me. This is a COOKED_READ territory, not cmd.exe.
The
Terminate batch job (Y/N)?
call is represented in the system as<noalias>
(this is its exe name), so the input for it can be altered using doskey macro. To be sure, try the following example (run test1.cmd, press Ctrl+C, and press n):test1.cmd:
The next test works in WT on Windows10 but does not work directly in conhost:
test2.cmd:
The
doskey /exename=^<noalias^> �=y
command contains ASCII character with code 0x03 (ETX, Ctrl+C). It can be inserted to the test2.cmd using for example Notepad++ by typing text 03, select it, and apply plugin Plugins->Converter->HEXtoASCII.Perhaps you can think through this idea and come up with a full-fledged workaround.Anyway, it is possible to handle Ctrl+C keypress per exe-name (e.g. =
<noalias>
) as a special (may be configurable) case, and do not touching cmd.exe itself.UPDATE: Now you could try how it works in vtm without any doskey shims (tested and works fine on Win8/Win10/Win11/Server2019Core/Server2019/Server2022 (including localized))
Command.Prompt.-.cmd.2023-10-28.20-11-06.mp4
UPDATE2: It has a small side effect on copy/move/del commands (perhaps we must filter it by looking at the last key pressed != Ctrl+C)UPDATE3: Interference with copy/move/del has been eliminated: