Search code examples
batch-filecmdechoascii-art

Echo help- how to use || in echo


I have been trying to use echo to print this ASCII art in the Command Prompt.

  _____             _____
  |_____|___________|_____|
  |_____| / _____ \ |_____|
  |_____|/ /\___/\ \|_____|
 /|====|__/_/___\_\__|====|\
 ||====|  _/_\_/_\_  |====||
 \|====| | \ ... / | |====|/
       |__\ `---' /__|
        |==\_____/==|
        |===|===|===|
        |===|+-+|===|
        >|||<   >|||<
        |---|   |---|
        || ||   || ||
        || ||   || ||
        >= =<   >= =<
        |===|   |===|
        >---/   \---<
        ||#|     |#||
        ||-|\   /|-||
        ||+||   ||+||
        ||-|/   \|-||
        ||_|\   /|_||      
     ___|/-\/   \/-\|___
    /________\ /________\

but i couldn't and after a bit of research, i learned you could use ^ to solve echo misunderstanding, but this doesnt seem to work with ||.

Heres my code-

ECHO ^|_____|___________|_____|^
ECHO   ^|_____| / _____ \ |_____|^
ECHO   ^|_____|/ /\___/\ \|_____|^
ECHO  ^/|====|__/_/___\_\__|====|\^
ECHO  ^||====|  _/_\_/_\_  |====||^
ECHO  ^\|====| | \ ... / | |====|/^
ECHO        ^|__\ `---' /__|^
ECHO         ^|==\_____/==|^
ECHO         ^|===|===|===|^
ECHO         ^|===|+-+|===|^
ECHO         ^>|||<   >|||<                             You are in good company. The Catapult will fire^
ECHO         ^|---|   |---|                             up your pc with sweetness. He may look like he is^ 
ECHO         ^|| ||   || ||                             is hacking, hes a good guy tho.^
ECHO         ^|| ||   || ||^
ECHO         ^>= =<   >= =<^
ECHO         ^|===|   |===|^
ECHO         ^>---/   \---<^
ECHO         ^||#|     |#||^
ECHO         ^||-|\   /|-||^
ECHO         ^||+||   ||+||^
ECHO         ^||-|/   \|-||^
ECHO         ^||_|\   /|_||^     
ECHO      ___^|/-\/   \/-\|^___
ECHO     ^/________\ /________\^

I am a complete beginner with no experience with cmd but a little with the unix terminal.


Solution

  • You need to escape each | and <, >.

    Here is an example using just the first line.

    echo ^|_____^|___________^|_____^|
    

    But, there are easier ways to do this though:

    @echo off
    for /F "delims=# tokens=1*" %%i in ('findstr.exe /B /C:":#" "%~f0"') do echo %%j
    
    rem all your other code here
    
    goto :EOF
    :#   _____             _____
    :#  |_____|___________|_____|
    :#  |_____| / _____ \ |_____|
    :#  |_____|/ /\___/\ \|_____|
    :# /|====|__/_/___\_\__|====|\
    :# ||====|  _/_\_/_\_  |====||
    :# \|====| | \ ... / | |====|/
    :#       |__\ `---' /__|
    :#        |==\_____/==|
    :#        |===|===|===|
    :#        |===|+-+|===|
    :#        >|||<   >|||<
    :#        |---|   |---|
    :#        || ||   || ||
    :#        || ||   || ||
    :#        >= =<   >= =<
    :#        |===|   |===|
    :#        >---/   \---<
    :#        ||#|     |#||
    :#        ||-|\   /|-||
    :#        ||+||   ||+||
    :#        ||-|/   \|-||
    :#       ||_|\   /|_||      
    :#     ___|/-\/   \/-\|___
    :#    /________\ /________\