@echo off
setlocal EnableDelayedExpansion
set Num=1
for /l %%i in (1,1,6) do (
if !Num! LEQ 16 for %%n in (0 1 2 3 4 5 6 7 8 9 a b c d e f) do set color!Num!=ff%%n%%n00&set /a Num+=1
if !Num! GTR 16 if !Num! LEQ 31 for %%n in (e d c b a 9 8 7 6 5 4 3 2 1 0) do set color!Num!=%%n%%n!color16:~-4!&set /a Num+=1
if !Num! GTR 31 if !Num! LEQ 46 for %%n in (1 2 3 4 5 6 7 8 9 a b c d e f) do set color!Num!=!color31:~0,4!%%n%%n&set /a Num+=1
if !Num! GTR 46 if !Num! LEQ 61 for %%n in (e d c b a 9 8 7 6 5 4 3 2 1 0) do set color!Num!=!color46:~0,2!%%n%%n!color46:~-2!&set /a Num+=1
if !Num! GTR 61 if !Num! LEQ 76 for %%n in (1 2 3 4 5 6 7 8 9 a b c d e f) do set color!Num!=%%n%%n!color61:~-4!&set /a Num+=1
if !Num! GTR 76 if !Num! LEQ 90 for %%n in (e d c b a 9 8 7 6 5 4 3 2 1) do set color!Num!=!color76:~0,4!%%n%%n&set /a Num+=1
)
:Main
cls
echo.
set Num=
set input=
set /p Num= 输入开始颜色(红绿蓝):
for %%n in (R G B) do if /i "%Num%" == "%%n" goto input
goto Main
:input
set /p input= 输入文字:
if not defined input exit
if /i "%Num%" == "R" set Num=0
if /i "%Num%" == "G" set Num=30
if /i "%Num%" == "B" set Num=60
cd.>test.txt
:loop
set /a Num+=1
>>test.txt set /p=%input:~0,1%<nul
set "input=%input:~1%"
if %num% GEQ 90 set Num=
if not "%input%" == "" goto loop
start test.txt
goto Main
exit