这是我试过的不起作用的脚本:
@echo off
:start
:randomcolors
echo Warning: 1/30 chance to crash
pause>nul
cls
set back1=null
set back2=null
set back3=null
set back4=null
set /a integertype=%random% %% 2+1
if %integertype%==1 set sys=#
if %integertype%==2 set sys=str
if %integertype%==1 set /a back1=%random% %% 9+1
if %integertype%==2 set /a back2=%random% %% 6+1
if back1=null goto skiprc
set color 2=%back3%
goto skiprc2
:skiprc
if %back2%==1 set %back2%=a
if %back2%==2 set %back2%=b
if %back2%==3 set %back2%=c
if %back2%==4 set %back2%=d
if %back2%==5 set %back2%=e
if %back2%==6 set %back2%=f
if %back1%=1 set com1=1
if %back1%=2 set com1=2
if %back1%=3 set com1=3
if %back1%=4 set com1=4
if %back1%=5 set com1=5
if %back1%=6 set com1=6
if %back1%=7 set com1=7
if %back1%=8 set com1=8
if %back1%=9 set com1=9
if %back2%=a set com1=a
if %back2%=b set com1=b
if %back2%=c set com1=c
if %back2%=d set com1=d
if %back2%=e set com1=e
if %back2%=f set com1=f
:skiprc2
:part2
set /a integertype2=%random% %% 2+1
if %integertype2%==1 set sys=number
if %integertype2%==2 set sys=string
if %integertype2%==1 set /a back3=%random% %% 9+1
if %integertype2%==2 set /a back4=%random% %% 6+1
if back3=null goto skiprc3
set color 1=%back3%
goto skiprc4
:skiprc3
if %back4%==1 set %back4%=a
if %back4%==2 set %back4%=b
if %back4%==3 set %back4%=c
if %back4%==4 set %back4%=d
if %back4%==5 set %back4%=e
if %back4%==6 set %back4%=f
:skiprc4
if %back3%=1 set com2=1
if %back3%=2 set com2=2
if %back3%=3 set com2=3
if %back3%=4 set com2=4
if %back3%=5 set com2=5
if %back3%=6 set com2=6
if %back3%=7 set com2=7
if %back3%=8 set com2=8
if %back3%=9 set com2=9
if %back4%=a set com2=a
if %back4%=b set com2=b
if %back4%=c set com2=c
if %back4%=d set com2=d
if %back4%=e set com2=e
if %back4%=f set com2=f
:action
color %com1%%com2%
pause
goto action
答案 0 :(得分:1)
如果有帮助,以下示例应生成随机控制台配色方案:
@Echo Off
SetLocal EnableDelayedExpansion
:loop
Set/A b=!random! %% 16
Set/A f=!random! %% 16
If %b% Equ %f% GoTo :loop
Set h=0123456789ABCDEF
Set c=!h:~%b%,1!!h:~%f%,1!
COLOR %c%
Timeout -1