Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

ANSI escape sequences in PROMPT

Hello

I have a prompt $e[91m$p$g$e[0m statement in my 4start.btm file, to render the prompt in red so that it acts as a sort of visual delimiter between each command's output. This works as expected most of the time, but occasionally Take Command starts and displays the "non-ANSI-interpreted" version of the prompt. After the first command is executed, or just pressing the Enter key to input a blank command, the coloured prompt is then shown correctly.

I can work around this by adding a short pause at the end of 4start.btm, using pause /w1 /c

It's as though the "ANSI interpreter" in Take Command is not always initialised by the time the first prompt is shown.

This is happening in Take Command 33.00.8, but it was also happening in version 32 and possibly earlier versions too.

Please could you take a look when you have a moment? Thank you!

:smile:

Chris



1727249849709.webp
 
What operating system? I don't know what the problem is. Rex will probably have more to say.

I use Windows10 and a slightly different approach. My prompt is set in the user environment. I have not had a problem in many versions.

Code:
d:\tc33> set /u prompt
$e[92m$p$g$s$e[0m

That also works in CMD and Powershell.

That's bright green. My TCSTART.BTM changes it to bright red in elevated TCCs.

Code:
IF %_ELEVATED == 1 SET prompt=$e]9;9;"$P"$e\$e[91m$p$g$s$e[0m

In TCMD.INI I have these.

Code:
[4NT]
ANSIWin10=Yes
ANSI=Yes
[TakeCommand]
ANSI=No
 
It's a Windows issue, not a TCC / TCMD issue. The ANSI processing is done in the Windows console code, and there seems to be a timing issue with some systems when it actually takes effect after startup. (This may also depend on which of the two Windows consoles you're using, and what your Windows console settings are.)

BTW, the "ANSIWin10" directive is obsolete and no longer used.
 
Thanks very much to both of you. It's Windows 11, and I had a suspicion that Rex would say that it's a timing issue within the Windows console code. It's not a big deal, and like I said adding the pause command works around the issue. Thanks again for getting back to me! Chris.
 
What else is in TCSTART.BTM? Does it call any externals (EXEs) or create any transient instances of TCC (pipes, for example)?
 
Back
Top