How to change the text color of comments line in a batch file

前端 未结 3 1477
感情败类
感情败类 2020-12-17 07:22

I have a batch file as follows:

myfile.bat
:: This is a sample batch file

@echo off
echo change directory to d: <---How to change color of only this line         


        
3条回答
  •  温柔的废话
    2020-12-17 07:53

    This is source code for a program that does what you want: http://www.mailsend-online.com/blog/setting-text-color-in-a-batch-file.html

    I am beginning to think that there is no longer a built-in way to do this without an additional program, or modifications to the user's system.

    An aside - For my scenario, if modifications to the user's system was a requirement, I'd simply opt to use python, IronPython, or JScript.NET instead.

提交回复
热议问题