Different Colours in Batch Files

Introduction: Different Colours in Batch Files

About: I enjoy anything to do with computers. I have made some interesting scripts, and I am constantly improving my skill set. One day I hope to become a programmer, although in what category is still a mystery (...

Everyone, with the help of g-one, I have created a function that you can install into your windows/system32 folder to get more than one colour in batch files.

Copy and paste the following code and save it as ncol.bat (this is very important that you save it exactly like that).

@echo off
if "%~1"=="/?" (
echo    ncol ["Text"] [Colour]
echo "Text" - The text you want displayed in another colour.
echo          Remember that spaces cannot be added if you don't put the text in
echo          quotation marks (""^).
echo Colour - The hexadecimal colour code that you want the text to be changed into.
echo          For more information of colour codes, see "color /?"
exit /b
for /f "delims=#" %%i in ('"prompt #$H# &for %%b in (1) do rem"') do set "bs=%%i"
"%~1.@" set /p "=.%bs%%bs%%bs%%bs%"
findstr /p /a:%2 . "*.@"
del "*.@"
@echo on
@exit /b

Once that is done, head over to your windows system32 folder and save it in there (C:\Windows\System32)

Read on for instructions...

Step 1: Instructions

Ok, how to use this function.

Firstly, type it in as you would any command "ncol"

The first parameter is the text you want converted.

The second parameter is the colour (must be correspondent to the colour command).


ncol "Hello" 10

Would output:


Just try it!

Note: If you have spaces, you must use quotation marks ("").

P.S: type in "ncol /?" for more help.

Unfortunately, special characters cannot be converted yet... (~!@#$%^&*()_+=-/,.<>":;'[]\{}|`)

And there is a little glitch with it, but other than that... It's good to go!

To add more colors onto one line, use the && operator. E.g: ncol "Hello " 12 && ncol "there" 23
would output "Hello " in one color, and "there" in another.



    • Water Contest

      Water Contest
    • Metalworking Contest

      Metalworking Contest
    • Fix It! Contest

      Fix It! Contest

    25 Discussions

    umm... when i do that i get

    '"Hello.@"' is not recognized as an internal or external command,
    operable program or batch file.
    FINDSTR: Cannot open *.@
    Could Not Find C:\Users\MyName\*.@

    No its fine, i found a different program that does the same thing but works. I still like ur idea though.

    2 replies

    Im making a movement simulator game in batch (Kind of like Terraria) And for every block is a character (or piece of text). I really want to save myself from writing over 300 variables. So is there a way to have arrays in batch?

    Everyone I made a version that works view it here


    Hey Pickle! just wanted to say thanks because your instructables have really helped me with getting into batch but just a question. Why don't you create any more instructables? it would be really nice if you had more :)

    2 replies

    but he doesn't post anymore does he? his last post was maybe 1 or 2 years ago. He used to be the person who fixed all my codes that didn't work and now i have piles of not working code

    Thanks, I've been trying to find a code for this. I'm thinking of using it in my Trivia.

    You should add here the *.@ file that you have in your system32 because we need that and thats why it isnt working

    It says the following when i type "ncol" in cmd.exe

    '".@"' is not recognized as an internal or external command,

    operable program or batch file.

    FINDSTR: Argument missing after /a

    Could not find C:\Users\****** ********\*.@

    6 replies

    NCOL is a function, meaning that you need to put in the name (ncol) and then the arguments. Type in "ncol /?" for more information.

    As hard as I try, I can not recreate the issue on my computer. I don't really have any solid ideas as to why it is doing that for you and Mclover, but I will keep trying.