Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have this batch file i wrote, and i wrote it to make specific words to be different colors, as a test.

But so far, i can't get any farther than this, I'm stuck, and I was wanting to use it to make other words in different colors, to make a color coding scheme. But can't figure out how. I've honestly spent weeks trying to figure this one out but am having no luck.

Here is my code:

MD Color
CD Color
cls
echo Cool> "Text to Color"
echo Hello> "Test"
echo Test> "Helloo"
cls
FINDSTR /A:0c /C:"Cool" /S "Text to Color"
FINDSTR /A:0b /C:"Hello" /S "Test"
FINDSTR /A:0a /C:"Test" /S "Helloo"
CD..
RD /S /Q Color
@pause

The name of the file is "Text to Color.bat" in a folder named "Color"

Result

C:\Users\CST27\Dropbox\Color\Color>FINDSTR /A:0c /C:"Cool" /S "Text to Color"
Text to Color:Cool

C:\Users\CST27\Dropbox\Color\Color>FINDSTR /A:0b /C:"Hello" /S "Test"
Test:Hello

C:\Users\CST27\Dropbox\Color\Color>FINDSTR /A:0a /C:"Test" /S "Helloo"
Helloo:Test

C:\Users\CST27\Dropbox\Color\Color>CD..

C:\Users\CST27\Dropbox\Color>RD /S /Q Color
Press any key to continue . . .

With "text to color" in red, "test" in blue, and "Helloo" in green.

And I was wanting to maybe try and make the words after those in a different color as well.

share|improve this question
up vote 2 down vote accepted

Use Windows PowerShell instead of cmd.exe

Write-Host -ForegroundColor Red -Object "Hello";
Write-Host -BackgroundColor Blue -Object "World!";
share|improve this answer
    
Now, can i make a batch file or some type of file that opens in windows powershell? – JustinD Nov 29 '12 at 13:24
    
PowerShell commands can be executed in a script, and vice versa. The script contents should be saved to a .ps1 file. There is lots of documentation about how to execute scripts. technet.microsoft.com/en-us/library/ee176949.aspx – Trevor Sullivan Nov 29 '12 at 14:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .