batch-filecmdascii-artwindows-terminal

ASCII Art gets bugged 1 out of 10-15 times when I open my batch file


I am working on a batch file that has ASCII art as a welcome page.

The ASCII art gets echoed weirdly sometimes. It is missing some of the bottom lines. It is supposed to look like this.

I tried changing the window height and width of cmd.exe/terminal.exe as suggested here. I tested it with mode cols=135 lines=38 (with that the ASCII art has 1 empty line above and 1 empty line beneath it) and mode con: cols=135 lines=60 where as with lines=60 the "bug" seems to occur less frequently (around 1 in 30-35 times). I changed the terminal.exe's window height and width via it's Settings tab to the same values. Increasing the value for the window's height seems to make the "bug" occur less frequently.

I also tried using type "ASCII.txt" which made the "bug" more apparent (more lines missing).

But I want to keep the cmd.exe/terminal.exe window small. Is there a way to have my ASCII art displayed without any occurring bugs with mode con: cols=135 lines=38 and without having to make my ASCII art smaller?

This is my code for reference:

@echo off
title fantazia.pw
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

Solution

  • You might be seeing a combination of:

    The Windows Terminal currently doesn't support a commandline application resizing the dimensions of the viewport. That includes trying to set the window size with mode

    If it's the second thing (which I'm more confident about), then I think that should be fixed in Terminal 1.18