How to create "drawings" in files written in Batch

0

My question is:

How do I add "drawings" in my .bat code like the ones that appear in the Linux Terminal?

Itriedtoinsertthe"drawing" using the FIGlet Generator tool. But when I run the file (source code) to open in Windows Command Prompt it opens and closes at a very fast speed. Even with the Pause > nul command, it does not remain open. So I can not see the error.

I believe it is occurring perhaps by the use of the character | which is already reserved for commands (so the syntax would be wrong).

    
asked by anonymous 27.11.2017 / 20:37

1 answer

6

This is known as ASCII ART (a common / vulgar term), it does not mean that it is an official term, its basic is to write even based on ASCII table characters to "simulate" a drawing, not well a programming problem, however the part that fits the programming is to understand that it is necessary to use this 2 commands:

  • echo
  • pause

Using this tool I created a text link , I got this:

  _________ __                 __    
 /   _____//  |______    ____ |  | __
 \_____  \   __\__  \ _/ ___\|  |/ /
 /        \|  |  / __ \  \___|    < 
/_______  /|__| (____  /\___  >__|_ \
        \/           \/     \/     \/

However note that characters like < , > , | , & should be escaped using the ^ sign

So it should look like this:

  _________ __                 __    
 /   _____//  ^|______    ____ ^|  ^| __
 \_____  \   __\__  \ _/ ___\^|  ^|/ /
 /        \^|  ^|  / __ \  \___^|    ^< 
/_______  /^|__^| (____  /\___  ^>__^|_ \
        \/           \/     \/     \/

An example of a .bat file would look like this:

@echo off

echo   _________ __                 __
echo  /   _____//  ^|______    ____ ^|  ^| __
echo  \_____  \   __\__  \ _/ ___^|  ^|/ /
echo  /        \^|  ^|  / __ \  \___^|    ^<
echo /_______  /^|__^| (____  /\___  ^>__^|_ \
echo         \/           \/     \/     \/

pause
  

It is important to note that the default Windows CMD has a limit; if the text exceeds this limit it will be broken to the next line (I think the limit is 80 characters, maybe it will change on older systems )

The result

Of course some things will have to be adjusted manually, but it's not that complicated, see the result:

    
27.11.2017 / 20:54