How to create "drawings" in Batch written files

Asked

Viewed 8,796 times

1

My question is this::

How do I add "drawings" to my code . bat like the ones that appear on the Linux terminal?

inserir a descrição da imagem aqui

I tried to insert the "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’t see the error.

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

1 answer

8


This is known as ASCII ART (a common/common term), does not mean that it is an official term, the basic of it is you write even based on ASCII table characters to "simulate" a drawing, not quite 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 http://patorjk.com/software/taag/#p=display&f=Graffiti&t=Stack, got this:

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

However note that characters like <, >, |, & must be used escape signal ^

So it should stay that way:

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

An example of a file .bat would be so:

@echo off

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

pause

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


The result

Of course some things will have to adjust manually, but it’s not so complicated, see the result:

Resultado

Browser other questions tagged

You are not signed in. Login or sign up in order to post.