1

I'm currently coding a project on two diffrent computers (Main is windows 10 and secondary is windows 7)

The problem is that Windows 10 allows for the use of ANSI escape sequences in batch, i wish i could say the same for Windows 7. I'm looking for a solution that dosn't end in me downloading anything external.

Code example:

(ESC)[93mYellow text(ESC)[0m

The (ESC) shows us as an arrow in Windows 7 batch while it works solid in Windows 10 I have googled a little bit and added a path to ansi.sys as far as i got it explained then that should do the magic but it left me unsatisfied when i gave it ago again and it still showed up as arrows...

NizonRox
  • 143
  • 14
  • 3
    It was a fundamental change in Windows 10 conhost.exe. Nothing to do with cmd.exe. Even if you coded this in Powershell you would still be crippled on Windows 7. – Squashman Nov 27 '16 at 00:25
  • 2
    Related: http://www.dostips.com/forum/viewtopic.php?f=3&t=5772&p=35898#p35898 – Aacini Nov 27 '16 at 00:48
  • I will fool around with this for a while thanks :) – NizonRox Nov 27 '16 at 12:04
  • Or, if you're simply looking to have multiple colors in a batch file, you can avoid ANSI sequences entirely: http://stackoverflow.com/questions/4339649/how-to-have-multiple-colors-in-a-windows-batch-file – SomethingDark Nov 27 '16 at 15:22

1 Answers1

0

Ansi.sys is in the system32 folder. Look at CONFIG.NT in the same place for an example of how to load device drivers.

To use the ansi driver after you have loaded it, run your batch file like this:

command /c myfile.bat

(that provides a command shell that is ansi enabled)

david
  • 2,435
  • 1
  • 21
  • 33