How to have multiple colors in a Windows batch file?

前端 未结 12 1674
我寻月下人不归
我寻月下人不归 2020-11-22 01:05

I was wondering if its possible to have different colored text on the same line in a Windows batch file, for example if it says

echo hi world
12条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-11-22 01:20

    You should download chgcolor.zip from http://www.mailsend-online.com/blog/setting-text-color-in-a-batch-file.html and also download echoj.zip from www.mailsend-online.com/blog/?p=41 They're both towards the bottom of the page. Extract both folders to the desktop and copy the executables(.exe files) from inside the extracted folders to the C:\Windows directory. This will allow them to be executed from the command line. Open up notepad and copy the following into it:

    @echo off

    chgcolor 03

    echoj "hi "

    chgcolor 0d

    echoj "world"

    chgcolor 07

    echoj $0a

    Save the file to the Desktop as hi.bat. Now open the command prompt and navigate to your Desktop folder and type "hi.bat" without the quotes. That should get you started besure to read both webpages to get a full tutorial.

提交回复
热议问题