Piping ANSI control sequences through 'type'

May 5, 2017

I have a cross-platform console application which emits ANSI control sequences to stdout. This works great in Linux with its native support for ANSI. However, I am trying to find a suitable workaround for Windows/TCC21 that will allow me to redirect its output through the X3.64 interpreter. TYPE seems to be my best option per the following text from the help:

TCC interprets only its own output, not the output of external commands. In some cases you can redirect the output of an application program to a temporary file, then send it through TCC ANSI X3.64 interpreter, e.g., by using the TYPE command. This will display ANSI X3.64 correctly, but will not work with an interactive application.

Indeed, myapp.exe | type "kind of" works. However, the application's output is seemingly not piped through type until after myapp.exe exits (almost like an in-process pipe). I have also tried myapp.exe | for %x in (@CON:) echo %x which behaves similarly (no output until the application exits). I've also tried piping the output through TAIL to no avail.

Is there any way to redirect the output of my application through TCC's ANSI X3.64 interpreter and observe the output as it is generated by the app? I've seen references in this forum to people injecting TCC's ANSI32.dll into processes but this seems both brutish and unsavory.


May 30, 2008
I use the "Y" command, without specifying a file name. This allows me to get ANSI output from external programs.

(You do get an extra line at the end)

Not sure if it has the TYPE and FOR issues you mentioned though, those did not work at all for me, i.e. failed to produce any output.
May 5, 2017
Fantastic! This worked swimmingly. I did not know you could use 'Y' without a filename (I had looked at it along with TEE but passed over it because of the file requirement).

Thanks, Niklas!

Edit: I did have to use setvbuf to force stdout/stderror to unbuffered I/O to make this work (for anyone who may follow this thread in the future).
Last edited:
Similar threads
Thread starter Title Forum Replies Date
vefatica Trouble piping Support 3
vefatica Piping to WSL? Support 4
H Behavior change re piping a string to a Java program Support 1
vefatica Piping Cscript.exe to HEAD? Support 9
vefatica Piping the output of a DO loop. Support 4
Peter Murschall TPIPE generate unicode on Piping or redirecting Support 3
vefatica Chaining and piping? Support 2
rps How to? Piping to View /gb Support 1
vefatica Piping to DO x in @con: Support 10
M Piping and redirection: CON: Support 5
vefatica Redirection vs. piping? Support 4
vefatica Fixed Piping to HEAD adds newlines Support 1
nikbackm Piping to new TCC instance crashes it Support 1
S Ctrl-C handling while piping Support 0
vefatica ANSI, PROMPT ... ??? Support 1
vefatica ANSI??? Support 9
samintz ANSI issues Support 3
FreezerBurnt ANSI Prompt messes up list output. Support 39
samintz ANSI Colors Support 33
nickles ANSI Colors Windows 7 no longer working Support 6
samintz WAD ANSI issue Support 3
AndrewJ TakeCommand v23 + ANSI color sequences leads to black on black text Support 6
K ANSI Not Working Support 8
vefatica ANSI, ANSIWin10 ... ? Support 2
vefatica Win10's ANSI doesn't like 2>NUL Support 10
vefatica How do I see Windows 10's ANSI in action? Support 3
M Please explain TCMD's ANSI x3.64 support Support 4
M ANSI is used to show files instead of OEM in version 17 to 19 ! Support 5
vefatica ANSI Support 11
vefatica WAD ANSI still misbehaves with build 35 Support 36
vefatica ANSI misbehavior????? Support 4
Peter Murschall UNICODE mixed with ANSI Code Support 11
gschizas Take Command (Environment) doesn't show v2 ANSI colors Support 30
B How to? Convert Unicode to ANSI Support 1
D Can ANSI escape sequences be used in keystroke aliases? Support 8
vefatica WAD ANSI <ESC>[K Support 5
M Ansi.sys and old Dos programs Support 7
R ansi.sys ?? Support 15
E Shorter prompt / ANSI codes support Support 10
Jay Sage Bug With Flow Control and/or Command Grouping Support 2
D History and control-C Support 1
C Control Everything CPU usage at startup? Support 7
M How to? Run the control panel from a TCC session... Support 2
D How move cursor out of popup edit control after no match? Support 14
Charles Dye Control-Shift-X Support 3
F How to? Stop hijacking control-shift-z Support 6
T TCC control-C copy operation Support 3
Mordachai how to control window size? Support 10
tmaynard How to? Control-U alias for Escape (command line editing) Support 5
vefatica Can I control forum drafts? Support 0

Similar threads