[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

批处理输出如下图形--闪电



答案暂时不公布
时光荏苒||新陈代谢&&涛声依旧||本性难移

  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
复制代码
1

评分人数

TOP

  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
复制代码

TOP

  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
复制代码
2

评分人数

TOP

返回列表