Emitting CRLF through ANSI escape sequences #20128

Open
opened 2026-01-31 07:04:26 +00:00 by claunia · 0 comments
Owner

Originally created by @mataha on GitHub (Jun 21, 2023).

Rather than a feature, I have a question regarding both Terminal and conhost.exe:

Is there a way to make the terminal emit CRLF through ANSI escape sequences?

Use-case: we (in a thread here) are trying to create a customizable prompt for cmd.exe with the aid of virtual terminal sequences. What we have currently is emitting DA (\e[0c) and creating a DOSKEY alias for the response (which is always \e[?1;0c). However, for that to work the macro would need to be executed somehow, hence the requirement to inject an Enter there.

Example PoC should that be necessary:

@setlocal DisableDelayedExpansion & echo off

for /f "skip=1" %%e in ('"echo(prompt $E| "%ComSpec%" /d /q /k 2>nul"') do (
    set "\e=%%~e"
)

"%windir%\System32\doskey.exe" %\e%[?1;0c = echo ...

set PROMPT=$E[0c$P$G$S ...
Originally created by @mataha on GitHub (Jun 21, 2023). Rather than a feature, I have a question regarding both Terminal and `conhost.exe`: Is there a way to make the terminal emit CRLF through ANSI escape sequences? Use-case: we (in a thread [here](https://www.dostips.com/forum/viewtopic.php?f=3&t=10840)) are trying to create a customizable prompt for `cmd.exe` with the aid of virtual terminal sequences. What we have currently is emitting DA (`\e[0c`) and creating a DOSKEY alias for the response (which is always `\e[?1;0c`). However, for that to work the macro would need to be executed somehow, hence the requirement to inject an Enter there. Example PoC should that be necessary: ```batchfile @setlocal DisableDelayedExpansion & echo off for /f "skip=1" %%e in ('"echo(prompt $E| "%ComSpec%" /d /q /k 2>nul"') do ( set "\e=%%~e" ) "%windir%\System32\doskey.exe" %\e%[?1;0c = echo ... set PROMPT=$E[0c$P$G$S ... ```
claunia added the Issue-FeatureNeeds-TriageNeeds-Tag-Fix labels 2026-01-31 07:04:27 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#20128