0

This is my batch file:

ansicon -p

[0;30;4;40mThis is a sentence.[0;1;31;40mThis is a sentence too.

pause

With @echo off in the batch file I'm only seeing:

's not recognized as an internal or external command, operable program or batch file.

With @echo on I'm seeing:

C:\Users\Admin\Downloads\Aranesp_injection_reminder\ANSICON>ansicon -p

C:\Users\Admin\Downloads\Aranesp_injection_reminder\ANSICON>This is a sentence.This is a sentence too.

's not recognized as an internal or external command, operable program or batch file.

What am I doing wrong?

Obs.: Using 0x1b for the ESC character.

Io-oI
  • 9,237

1 Answers1

0

Using 0x1b for the ESC character.

  • Use ESC saved in variable

  • In your batch file:
@echo off

color 0a

for /f skip^=4 %%b in ('"echo;prompt;$E|cmd"')do set "_esc=%%b"

echo/%_esc%[0;30;4;40mThis is a sentence. %_esc%[0;1;31;40mThis is a sentence too

timeout 3 >nul & color f0


  • In your command-line:
for /f skip^=4 %b in ('"echo;prompt;$E|cmd"')do @echo\ %b[0;30;4;40mThis is a sentence.%b[0;1;31;40m. This is a sentence too & timeout 3 >nul & color f0

ANSI Escape Sequences

Use ANSI colors in the terminal

Tetris.BAT by @Aacini

Flappy_Bird.bat

Pacman_kinda.bat

Library.bat Revision 4.1.0

Search for "Bat Games" on DosTips.com

Io-oI
  • 9,237