Multicolored Batch File
Solution 1
Use Windows PowerShell instead of cmd.exe
Write-Host -ForegroundColor Red -Object "Hello";
Write-Host -BackgroundColor Blue -Object "World!";
Solution 2
Just add
@echo off
and you will get a result like this-
Text to Color:Cool
Test:Hello
Helloo:Test
Press any key to continue . . .
With "Text to Color:" in red "Test:" in cyan and "Helloo:" in green
And I am grateful to you for uploading your code, Thanks bruh.
Related videos on Youtube
JustinD
Updated on September 18, 2022Comments
-
JustinD over 1 year
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.
-
JustinD over 11 yearsNow, can i make a batch file or some type of file that opens in windows powershell?
-
Trevor Sullivan over 11 yearsPowerShell 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
-
Deses almost 6 yearsDon't give a PS answer when the OP was asking for batch. You wouldn't like that someone answers your java question in pascal, wouldn't you?