This article mainly introduces batch processing printing color Yang Hui's triangle effect code, like a friend can test under
Effect Diagram: code is as follows: @echo Off&color 0e setlocal enabledelayedexpansion mode con:cols=130 lines=130:top cls:: set/p I n= Please enter the number of rows: Set In=23&set ab=1&set var=64 if "%in%" = "goto top if%in% geq goto top If%in% leq 0 goto Top Echo %IN%|FINDSTR/R "^[0-9][0-9]*$" >nul 2>nul| | Goto Top Set Str=1 for/l%%i in (1,1,%in%) does ( set num= set num2=0 for%%a in (!s tr!) Do ( set/a num2+=1 if!num2!==1 Set "str1=" set/a num1=%%a+num set " str1=!str1!!num1! " set num=%%a ) call:lis"!str1:~1! " set" str=!str1 ! 0 ") Rem again output an inverted pyramid to play. FOR/L%%a in (22-1 1) do echo!nam%%a! FOR/L%%i in (1 1 3) does ( for%%a in (a B c D E F) do ( color 0%%a ping/n 2 127.1>nul )) E Xit:lis set max=%~1 for/l%%a in (0 1) does (if not "!max:~%%a,1!" = = "" set/a ci+=1) set/a ki=var-ci/2 for/l%%a in (1 1!ki!) do set kg=!kG! Echo!kg!! max! Set nam!ab!=!kg!! max! set/a ab+=1 set Ci=0&set kg= goto:eof