简体   繁体   中英

ANSI escape sequences in batch

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...

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM