2010年12月18日星期六

Display color text in Windows .bat file

By default, Windows cmd.exe do not support ANSI escape sequence color code. But the old version of cmd.exe, i.e. command.exe support ANSI.SYS if you set it up in CONFIG.SYS.

I usually use cmd.exe, after google for awhile, I find a tool which can let you write a .bat file with color text display when you run the .bat in cmd.exe.

You can download the cecho executable in the site: Colors to Batch Files
Unzip it and put the cecho.exe in C:\Windows\System32.

I have write a test file color_win32.bat.txt for testing, download it and rename it to color_win32.bat then run in cmd.exe.

Here is the output:

沒有留言:

發佈留言