You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

批处理文件ASCII艺术显示异常求助(cols=135 lines=38)

解决批处理ASCII艺术在固定窗口尺寸下的显示缺失问题

问题根源

CMD/Terminal在快速输出大量文本时,窗口渲染速度跟不上输出节奏,尤其是当窗口缓冲区尺寸与可视窗口尺寸不一致时,容易出现底部行截断的情况。type命令一次性输出全部内容,触发异常的概率更高。

解决方案

以下方法均基于mode con: cols=135 lines=38的窗口配置,无需修改ASCII艺术内容:

1. 强制同步窗口缓冲区与可视尺寸

连续执行两次mode命令,确保缓冲区尺寸完全匹配窗口可视尺寸,避免滚动导致的内容截断:

@echo off
title fantazia.pw
:: 两次设置确保缓冲区与窗口同步
mode con: cols=135 lines=38
mode con: cols=135 lines=38

for /f "delims=: tokens=*" %%g in ('findstr /b ::: "%~f0"') do @echo(%%g

:::
:::                               .:-=======--:.:::                        .-=*%@@%%#**++++**#%@@@#+=:::                    .-*@@%*=:.                .-+#%@%*-:::                 .=#@%+-                           .-+%@#=.:::               -#@%+.                                  .=%@#-:::             -%@*:                                        :*@%=:::           :%@*.     ....                          ....     .*@%:::          +@%:  :+*++=--=+++*+=-:.        .:-=*+++==-=++*+-  :%@*:::        .%@+ .+*-           :@-:-=++++++++=-:-@-           -**. +@%.:::       .@@- +#.              %-              :@              .** :@@:::      .@@- #=    .+%*=-      %*              +%      -=*%*:    =# :@@.:::      #@+ *+    -@@+    :=++#%@*=-.      .:=*@%#+++:    =@@=    =# =@#:::     :@@ :%  +: *@@@+=+*-.      .:-++++++-:.      .-*+=+%@@# .+  %- %@-:::     +@* ++ *%  :@#-..:     -*##*=+%#==##*-*##*=     ::.-#@-  #* =* +@*:::     *@= #= +@%+#%         %*++@@@@@----@@@@@*+*%.        #%+%@* -% -@#:::     *@+ #-  =%@@@:       --  -@+##+-. -+##+@-  :=       .%@@%=  :% =@*:::     -@% %:     .:*#-       *@@@ -=-*++#-=- @@@*.      -#*-.     .@ #@=:::      @@:@.        =*      *@@#%%.  .##:  .#%#@@#      ++         @:@@:::      +@@#        .%%:     *@:             .  .@#     :%%.        #@@*:::      .@@*      -#@@@@@@%*=:++.              .+*:=*%@@@@@@#=      +@@:::    .=%@@#    .%@@@@@@%%@@@@%=. *@@%:  .#@@* .=%@@@@%%@@@@@@%.    *@@%+.:::  .#@%=:-@:   +@@@@=.     -+@@%:=%@@@  %@@%=:%@@*-.    .=@@@@*   .@-:=#@#.::: .@@=    =#   +@@@:  ==-=-++.=@@: :*+  +*- .@@+.=+-==-=  .@@@*   *+    -@@.::: +@*      %-   %@@: :=-@@% %@+-@%          #@==@@ %@@=-- .@@@.  :@      +@*::: *@+      :%    #@%. =:=+- -:+:@@          %@.*:- :++:= .%@#.   #-      =@#::: -@%       #= +- -@@+.:+#@=-::=@-          :@=::-=@%+- =@@= :+ -#       #@=:::  #@+      .%. +%@@%**#+==+++*+.             =*+++==+#**%@@%+ .%:      =@%:::   #@*      :%:       %@+..        .::::.        ..=@#       :%-      +@%.:::    +@%=      **:  :=**-        :#@#*++*#@#-        -**=:. .**.     -%@*:::     .*@@*-.   -@%=.           -@==+*##**=-@-.          .=#@=   .-*@@*.:::        -+#%@@@%#+%@#=.       :--::::::::::--:       .=#@%+*%@@@@#+-:::                   .+%@#+:.                      .:=#@%+.:::                      .=*%@@@%%##**********##%%@@@%#=:::                            .::---========---::.
<nul set /p "=press any key to continue..."
pause >nul
exit

2. 逐行延迟输出,给渲染留足时间

在输出每一行ASCII内容后添加微小延迟,避免CMD因输出过快丢失渲染帧:

@echo off
title fantazia.pw
mode con: cols=135 lines=38

:: 逐行读取并添加10毫秒延迟输出
for /f "delims=: tokens=*" %%g in ('findstr /b ::: "%~f0"') do (
    @echo(%%g
    :: 10毫秒延迟,不影响用户体验但足够完成渲染
    ping -n 1 -w 10 127.0.0.1 >nul
)

:::
:::                               .:-=======--:.:::                        .-=*%@@%%#**++++**#%@@@#+=:::                    .-*@@%*=:.                .-+#%@%*-:::                 .=#@%+-                           .-+%@#=.:::               -#@%+.                                  .=%@#-:::             -%@*:                                        :*@%=:::           :%@*.     ....                          ....     .*@%:::          +@%:  :+*++=--=+++*+=-:.        .:-=*+++==-=++*+-  :%@*:::        .%@+ .+*-           :@-:-=++++++++=-:-@-           -**. +@%.:::       .@@- +#.              %-              :@              .** :@@:::      .@@- #=    .+%*=-      %*              +%      -=*%*:    =# :@@.:::      #@+ *+    -@@+    :=++#%@*=-.      .:=*@%#+++:    =@@=    =# =@#:::     :@@ :%  +: *@@@+=+*-.      .:-++++++-:.      .-*+=+%@@# .+  %- %@-:::     +@* ++ *%  :@#-..:     -*##*=+%#==##*-*##*=     ::.-#@-  #* =* +@*:::     *@= #= +@%+#%         %*++@@@@@----@@@@@*+*%.        #%+%@* -% -@#:::     *@+ #-  =%@@@:       --  -@+##+-. -+##+@-  :=       .%@@%=  :% =@*:::     -@% %:     .:*#-       *@@@ -=-*++#-=- @@@*.      -#*-.     .@ #@=:::      @@:@.        =*      *@@#%%.  .##:  .#%#@@#      ++         @:@@:::      +@@#        .%%:     *@:             .  .@#     :%%.        #@@*:::      .@@*      -#@@@@@@%*=:++.              .+*:=*%@@@@@@#=      +@@:::    .=%@@#    .%@@@@@@%%@@@@%=. *@@%:  .#@@* .=%@@@@%%@@@@@@%.    *@@%+.:::  .#@%=:-@:   +@@@@=.     -+@@%:=%@@@  %@@%=:%@@*-.    .=@@@@*   .@-:=#@#.::: .@@=    =#   +@@@:  ==-=-++.=@@: :*+  +*- .@@+.=+-==-=  .@@@*   *+    -@@.::: +@*      %-   %@@: :=-@@% %@+-@%          #@==@@ %@@=-- .@@@.  :@      +@*::: *@+      :%    #@%. =:=+- -:+:@@          %@.*:- :++:= .%@#.   #-      =@#::: -@%       #= +- -@@+.:+#@=-::=@-          :@=::-=@%+- =@@= :+ -#       #@=:::  #@+      .%. +%@@%**#+==+++*+.             =*+++==+#**%@@%+ .%:      =@%:::   #@*      :%:       %@+..        .::::.        ..=@#       :%-      +@%.:::    +@%=      **:  :=**-        :#@#*++*#@#-        -**=:. .**.     -%@*:::     .*@@*-.   -@%=.           -@==+*##**=-@-.          .=#@=   .-*@@*.:::        -+#%@@@%#+%@#=.       :--::::::::::--:       .=#@%+*%@@@@#+-:::                   .+%@#+:.                      .:=#@%+.:::                      .=*%@@@%%##**********##%%@@@%#=:::                            .::---========---::.
<nul set /p "=press any key to continue..."
pause >nul
exit

3. 使用more命令控制输出节奏

more命令会自动适配窗口尺寸输出内容,避免一次性加载导致的渲染异常。先将内嵌的ASCII内容写入临时文件再输出:

@echo off
title fantazia.pw
mode con: cols=135 lines=38

:: 提取内嵌ASCII内容到临时文件
findstr /b ::: "%~f0" | findstr /v "^:::" > "%temp%\temp_ascii.txt"
:: 用more命令适配窗口输出
more "%temp%\temp_ascii.txt"
:: 清理临时文件
del "%temp%\temp_ascii.txt"

:::
:::                               .:-=======--:.:::                        .-=*%@@%%#**++++**#%@@@#+=:::                    .-*@@%*=:.                .-+#%@%*-:::                 .=#@%+-                           .-+%@#=.:::               -#@%+.                                  .=%@#-:::             -%@*:                                        :*@%=:::           :%@*.     ....                          ....     .*@%:::          +@%:  :+*++=--=+++*+=-:.        .:-=*+++==-=++*+-  :%@*:::        .%@+ .+*-           :@-:-=++++++++=-:-@-           -**. +@%.:::       .@@- +#.              %-              :@              .** :@@:::      .@@- #=    .+%*=-      %*              +%      -=*%*:    =# :@@.:::      #@+ *+    -@@+    :=++#%@*=-.      .:=*@%#+++:    =@@=    =# =@#:::     :@@ :%  +: *@@@+=+*-.      .:-++++++-:.      .-*+=+%@@# .+  %- %@-:::     +@* ++ *%  :@#-..:     -*##*=+%#==##*-*##*=     ::.-#@-  #* =* +@*:::     *@= #= +@%+#%         %*++@@@@@----@@@@@*+*%.        #%+%@* -% -@#:::     *@+ #-  =%@@@:       --  -@+##+-. -+##+@-  :=       .%@@%=  :% =@*:::     -@% %:     .:*#-       *@@@ -=-*++#-=- @@@*.      -#*-.     .@ #@=:::      @@:@.        =*      *@@#%%.  .##:  .#%#@@#      ++         @:@@:::      +@@#        .%%:     *@:             .  .@#     :%%.        #@@*:::      .@@*      -#@@@@@@%*=:++.              .+*:=*%@@@@@@#=      +@@:::    .=%@@#    .%@@@@@@%%@@@@%=. *@@%:  .#@@* .=%@@@@%%@@@@@@%.    *@@%+.:::  .#@%=:-@:   +@@@@=.     -+@@%:=%@@@  %@@%=:%@@*-.    .=@@@@*   .@-:=#@#.::: .@@=    =#   +@@@:  ==-=-++.=@@: :*+  +*- .@@+.=+-==-=  .@@@*   *+    -@@.::: +@*      %-   %@@: :=-@@% %@+-@%          #@==@@ %@@=-- .@@@.  :@      +@*::: *@+      :%    #@%. =:=+- -:+:@@          %@.*:- :++:= .%@#.   #-      =@#::: -@%       #= +- -@@+.:+#@=-::=@-          :@=::-=@%+- =@@= :+ -#       #@=:::  #@+      .%. +%@@%**#+==+++*+.             =*+++==+#**%@@%+ .%:      =@%:::   #@*      :%:       %@+..        .::::.        ..=@#       :%-      +@%.:::    +@%=      **:  :=**-        :#@#*++*#@#-        -**=:. .**.     -%@*:::     .*@@*-.   -@%=.           -@==+*##**=-@-.          .=#@=   .-*@@*.:::        -+#%@@@%#+%@#=.       :--::::::::::--:       .=#@%+*%@@@@#+-:::                   .+%@#+:.                      .:=#@%+.:::                      .=*%@@@%%##**********##%%@@@%#=:::                            .::---========---::.
<nul set /p "=press any key to continue..."
pause >nul
exit

推荐方案

优先尝试方案1+方案2的组合,既确保窗口缓冲区同步,又通过微小延迟避免输出过快,无需额外文件操作,稳定性最优。

内容的提问来源于stack exchange,提问作者leiseg

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.22 11:47:56