![]() |
Rainbow Text in Command Prompt
1 Attachment(s)
So I'm coding a silly little program in .bat for command prompt, and can't seem to figure out how colors and text work? This is what I have so far:
@echo off :start color 02 echo I eat poop goto start but it is just 1 color, I want it to change the text color but have the same text every time, or maybe diffrent text, that doesn't matter, just a diffrent color every line, say like this: @echo off :start color 02 echo I eat poop color 03 echo I eat poop color 04 echo I eat poop color 05 goto start I've tried that but it just keeps the text one color :( any help? also picture below |
By default you can't do this, there's no way to structurally have multiple colors by the calling color.exe because it's designed to change the full console's text. There is a work around fortunately.
http://i.imgur.com/Ou7Dlxe.png Using prompt.exe you can use Escape codes in a manner that enables you to have multiple colors in the console. Prompt.exe enables you to change the command prompt. For more information type "prompt /?" (without quotes), in your cmd prompt. Example: Code:
@echo off |
1 Attachment(s)
Thanks ^_^ works great, I don't really understand the top and bottom code , but this is what it got from it:
@echo off for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & for %%b in (1) do rem"') do ( set "DEL=%%a" ) SETLOCAL EnableDelayedExpansion :start call :C C0 "POOP`" call :C E0 "POOP`" call :C A0 "POOP`" call :C B0 "POOP`" goto start echo. pause && goto :eof :C echo off <nul set /p ".=%DEL%" > "%Temp%\%~2" cd %Temp% findstr /v /a:%1 /R "^$" "%~2" nul del "%Temp%\%~2" > nul 2>&1 goto :eof It works fine, but it would be nice if it printed faster, it takes about 20 seconds to fill the whole command prompt, anyway to make it faster? also moar pics in the bottem Also this same code works when on my hardrive, but not when on a flashdrive :/ |
1 Attachment(s)
also ALSO my copy script isn't working either trying to copy the fil
COPY F:\batrainbow.bat*.* C:\ pause batrainbow.bat being the colorful poop repeating file, but when I run it it gives me this: |
Why does the first argument have the filename and extension while you put a wildcard on a filename following another extension afterwards?
Code:
filename.ext*.* |
whats %0? ^_^ i'm a complete noobly to mostly all coding
|
Try it for yourself:
Code:
echo %0 |
|
| All times are GMT +1. The time now is 11:25 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.