The color command has to do with changing color of windows command promt background/text
color 0A - where 0 is the background color and A is the text color
I want to change these color of text every 1 second in windows batch script using an array with 1,2,3,4,5,6,7,8,9,A,B,C,D,E,F witch are the color codes.
0 = Black 8 = Gray
1 = Blue 9 = Light Blue
2 = Green A = Light Green
3 = Aqua B = Light Aqua
4 = Red C = Light Red
5 = Purple D = Light Purple
6 = Yellow E = Light Yellow
7 = White F = Bright White
the command should be go every second like this
color 01 color 02 color 03 .... color 0E color 0F
I found some little script to make it work to change the color for every 1 second!for /L %%i in (1,1,%n%) do echo !array[%%i]!
or this
@echo off CLS
for /l %%a in (15,-1,1) do (
color 0A
cls
)
pause
or this
SET COUNTDOWN=15
:COUNTDOWNLOOP
IF %COUNTDOWN%==0 GOTO END
color 0A && %R1%
CLS
SET /A COUNTDOWN -=1
GOTO COUNTDOWNLOOP
:END
相关示例如下:
title 我做的批处理文件测试 //标题
:welcome //相当于switch中的标签
cls //清屏
color 0A //字体颜色
echo 欢迎来到这里 //这一个是原样输出
echo %date% //输出当前日期
echo %time% //输出当前时间
set /p answer=
if %answer%==a goto a
if %answer%==b goto b
if %answer%==c goto c
if %answer%==d goto d
:a
@start/min iexplore mms://192.168.17.101/4050 //运行时候最小化 这个运行的是一个流媒体文件
goto welcome
:b
@start/min iexplore mms://192.168.17.101/4030
goto welcome
:c
@start/min iexplore mms://192.168.17.101/5030
goto welcome
:d
start explorer ftp://student:student@218.196.240.42
goto welcome