Board logo

标题: 批处理输出如下图形--闪电 [打印本页]

作者: 悬崖之树    时间: 2013-2-7 19:17     标题: 批处理输出如下图形--闪电



答案暂时不公布
作者: CrLf    时间: 2013-2-8 02:30

  1. @echo off&setlocal enabledelayedexpansion
  2. for /l %%a in (1 1 11) do set "空格=!空格! "&set "星号=!星号!*"
  3. for /l %%a in (1 1 10) do echo !空格:~%%a!!空格:~%%a!!星号:~,%%a!
  4. for /l %%a in (10 -1 1) do echo !空格:~-%%a!!星号:~-%%a!
  5. pause
复制代码

作者: 763244966    时间: 2018-4-26 17:58

  1. @echo off
  2. setlocal enabledelayedexpansion
  3. :: 初始化满值空格和星星
  4. for /l %%i in (1, 1, 10) do (
  5.     set "spaceStr=!spaceStr! "
  6.     set "starStr=!starStr!*"
  7. )
  8. :: 循环输出
  9. for /l %%i in (1, 1, 10) do (
  10.     echo   !spaceStr:~%%i!!spaceStr:~%%i!!starStr:~,%%i!
  11. )
  12. for /l %%j in (1, 1, 10) do (
  13.     echo !spaceStr:~%%j!!starStr:~%%j!
  14. )
  15. endlocal
复制代码

作者: 懒虫阿布    时间: 2018-7-22 18:38

  1. @echo off
  2. setlocal enabledelayedexpansion
  3. for /l %%i in (1,1,20) do (
  4. set starstr=!starstr!*
  5. set spacestr= !spacestr!
  6. )
  7. set spacelen=20
  8. set starlen=1
  9. :STARTLOOP
  10. if !starlen! GTR 10 goto LOOPEND
  11. echo !spacestr:~1,%spacelen%! !starstr:~0,%starlen%!
  12. set /a spacelen=!spacelen!-2
  13. set /a starlen=!starlen!+1
  14. goto STARTLOOP
  15. :LOOPEND
  16. set spacelen=9
  17. set starlen=10
  18. :STARTLOOP2
  19. if !starlen! LSS 1 goto LOOPEND2
  20. echo !spacestr:~1,%spacelen%! !starstr:~0,%starlen%!
  21. set /a spacelen=!spacelen!-1
  22. set /a starlen=!starlen!-1
  23. goto STARTLOOP2
  24. :LOOPEND2
复制代码





欢迎光临 批处理之家 (http://bathome.net./) Powered by Discuz! 7.2