标题: 批处理输出如下图形--闪电 [打印本页]
作者: 悬崖之树 时间: 2013-2-7 19:17 标题: 批处理输出如下图形--闪电
答案暂时不公布
作者: CrLf 时间: 2013-2-8 02:30
- @echo off&setlocal enabledelayedexpansion
- for /l %%a in (1 1 11) do set "空格=!空格! "&set "星号=!星号!*"
- for /l %%a in (1 1 10) do echo !空格:~%%a!!空格:~%%a!!星号:~,%%a!
- for /l %%a in (10 -1 1) do echo !空格:~-%%a!!星号:~-%%a!
- pause
复制代码
作者: 763244966 时间: 2018-4-26 17:58
- @echo off
-
- setlocal enabledelayedexpansion
- :: 初始化满值空格和星星
- for /l %%i in (1, 1, 10) do (
- set "spaceStr=!spaceStr! "
- set "starStr=!starStr!*"
- )
-
- :: 循环输出
- for /l %%i in (1, 1, 10) do (
- echo !spaceStr:~%%i!!spaceStr:~%%i!!starStr:~,%%i!
- )
- for /l %%j in (1, 1, 10) do (
- echo !spaceStr:~%%j!!starStr:~%%j!
- )
-
- endlocal
复制代码
作者: 懒虫阿布 时间: 2018-7-22 18:38
- @echo off
- setlocal enabledelayedexpansion
- for /l %%i in (1,1,20) do (
- set starstr=!starstr!*
- set spacestr= !spacestr!
- )
-
- set spacelen=20
- set starlen=1
- :STARTLOOP
- if !starlen! GTR 10 goto LOOPEND
- echo !spacestr:~1,%spacelen%! !starstr:~0,%starlen%!
- set /a spacelen=!spacelen!-2
- set /a starlen=!starlen!+1
- goto STARTLOOP
- :LOOPEND
- set spacelen=9
- set starlen=10
- :STARTLOOP2
- if !starlen! LSS 1 goto LOOPEND2
- echo !spacestr:~1,%spacelen%! !starstr:~0,%starlen%!
- set /a spacelen=!spacelen!-1
- set /a starlen=!starlen!-1
- goto STARTLOOP2
- :LOOPEND2
复制代码
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |