Documentation TCANSI error

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

samintz

Scott Mintz
May 20, 2008
1,232
11
Solon, OH, USA
#1
I didn't see any checkboxes in the Tcmd Option dialog for TCANSI, so I manually edited my tcmd.ini file.

I set ANSI=No in the [4NT] section and added TCANSI=Yes in the [TakeCommand] section.

I got the following startup error
upload_2016-7-26_17-12-33.png

So I changed the named from TCANSI to ANSI and that fixed it.

The help file has this text:
INI Directives:



TCANSI=NO|yes - Enable ANSI escape sequence support for all console applications running in Take Command tab windows. Take Command will inject a dll (ANSI32.dll or ANSI64.dll) into the console applications it starts. Note that if you have enabled TCANSI in Take Command, you should disable ANSI support in TCC (OPTION / Windows).
 
#2
Under "Tabs" there's an "ANSI Colors" checkbox. I checked it back when the feature was announced. In TCMD.INI I have two of "ANSI=Yes", one in the "4NT" section, one in the "TakeCommand" section.
 

samintz

Scott Mintz
May 20, 2008
1,232
11
Solon, OH, USA
#3
This is really cool. I have a PROMPT that uses ANSI to colorize my prompt. And every time I launch CMD from within TCC (or a batch script that leaves me in CMD after it runs) I always got this really ugly prompt because of the escape sequences in the prompt that got inherited but not evaluated.

Now I get a colorized prompt in CMD also! Now if I can figure out how to dynamically change the color...

Code:
prompt=`^e[37;%@if[%@remote[%_disk] eq 0,42,41];1m[$P]^e[33;40;1m$s`
CMD doesn't like the %@if[] in the prompt. I use it to change the background color of the $P to red for network drives and green for local drives.
 

samintz

Scott Mintz
May 20, 2008
1,232
11
Solon, OH, USA
#6
I figured it out.
Code:
reg add "HKCU\Software\Microsoft\Command Processor" /v AutoRun /t REG_EXPAND_SZ /d "%%USERPROFILE%%\autoexec.cmd" /f
echo @prompt=$e[37;44;1m[$P]$e[33;40;1m$s>%USERPROFILE%\autoexec.cmd
I changed the background color to blue when running in CMD. Very nice. Thank you for that suggestion.
 

samintz

Scott Mintz
May 20, 2008
1,232
11
Solon, OH, USA
#7
One thing I noticed is that the colors on the console disappear when CMD launches. When I exit CMD, its blue background prompt stays on the console display.
upload_2016-7-26_18-31-12.png
upload_2016-7-26_18-31-51.png
upload_2016-7-26_18-32-36.png
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,483
44
Albuquerque, NM
prospero.unm.edu
#8
One thing I noticed is that the colors on the console disappear when CMD launches. When I exit CMD, its blue background prompt stays on the console display.
CMD.EXE has always done that, AFAIK. I don't think it has anything to do with Take Command or TCC. You're just more likely to notice when starting CMD.EXE from TCC because TCC makes it easier to display multiple colors in the first place.
 
#9
One thing I noticed is that the colors on the console disappear when CMD launches. When I exit CMD, its blue background prompt stays on the console display.
No surprise. That prompt is history ... already in the console screen buffer.

TCMD isn't doing the interpretation of the ANSI sequences. CMD is ... because ANSI.DLL has been injected into it. If you have the means, you can inject it manually and do the same thing without TCMD. Here's an example in a real console. 2828 is CMD's PID.

upload_2016-7-26_19-37-26.png