@echo off color 0a :start set num=0 set "echos= " :num set /a a1=%random%%%3 if "%a1%" == "1" set "a1= " if "%a1%" == "2" set "a1= " if "%a1%" == "0" set /a a1=%random%%%2 set echos=%echos%%a1% set /a num=%num%+1 if "%num%" == "75" echo %echos%&&goto :start goto :num
我来详细解释一下
复制代码 代码如下:
@echo off ::关闭回显(不用说了吧)
color 0a ::这句的意思是改变批处理的字体颜色,0a就是颜色代码(具体可以看Color命令)
:start
set num=0 ::定义(重新定义)num的变量,值为0(我们用这个变量来计算批处理循环的次数)