Skip to main content

How to Create an ASCII Art Banner in a Batch Script

A well-crafted ASCII art banner is one of the easiest ways to add a professional and personalized touch to your batch scripts. A large, stylized title can make your script's output instantly recognizable, clearly separate different sections of its output, and provide a much better user experience than plain text.

This guide will teach you the simple process of creating and displaying an ASCII art banner. You will learn where to generate the art, how to display it with the ECHO command, and the single most important technique you'll need to master: escaping special characters to prevent your banner from breaking your script.

The Core Command: ECHO

The entire technique of displaying a banner relies on the fundamental ECHO command. Each line of your ASCII art will be printed to the screen by a separate ECHO command. You will also use ECHO. (echo with a dot) to print the blank lines needed for spacing.

Step 1: Generating the ASCII Art

You do not need to draw your banner by hand. The best way to create it is to use a free, online Text to ASCII Art Generator. These web tools can instantly convert any text into a variety of cool and interesting fonts.

A popular and easy-to-use generator is patorjk.com/software/taag/.

How to Use it:

  1. Go to the website.
  2. Type your desired text (e.g., "MY SCRIPT") into the input box.
  3. Experiment with different fonts until you find one you like (the "Standard" font is a great starting point).
  4. Click "Copy to Clipboard".

For example, generating the word "BANNER" with the "Standard" font gives you this:

  ____                              
| __ ) __ _ _ __ _ __ ___ _ __
| _ \ / _` | '_ \| '_ \ / _ \ '__|
| |_) | (_| | | | | | | | __/ |
|____/ \__,_|_| |_|_| |_|\___|_|

Step 2: Displaying the Art in Your Batch Script

Once you have copied your ASCII art, you simply paste it into your script and put the ECHO command in front of each line.

Script

@ECHO OFF
ECHO.
ECHO ____
ECHO | __ ) __ _ _ __ _ __ ___ _ __
ECHO | _ \ / _` | '_ \| '_ \ / _ \ '__|
ECHO | |_) | (_| | | | | | | | __/ |
ECHO |____/ \__,_|_| |_|_| |_|\___|_|
ECHO.
PAUSE

For art that contains no special characters, this is all you need.

The Critical Challenge: Handling Special Characters (|, &, >)

This is the most common and frustrating problem when using ASCII art. Many fonts use characters that have a special meaning to the cmd.exe command processor.

Problem Characters: &, |, <, >, ^, !, %

If your art contains one of these, the ECHO command will break.

Let's generate art for the text A | B. The result might look like this: __ | __.

REM This will FAIL.
ECHO __ | __

Output: '__' is not recognized as an internal or external command... This fails because the pipe (|) is a command operator. cmd.exe tries to run the command ECHO __ and pipe its output to the command __, which is invalid.

Solution: Escape Each Special Character with a Caret (^)

To tell the command processor to treat a special character as a literal piece of text, you must escape it by placing a caret (^) immediately before it.

The Rule: You must manually go through your ASCII art and place a ^ in front of every single special character.

The corrected script:

@ECHO OFF
REM This is now correct and will work.
ECHO __ ^| __

REM Example with more characters:
ECHO Show <this> & that ^| over 50%% ^!

The corrected line for the last ECHO would be:

ECHO Show ^<this^> ^& that ^^ ^| over 50%%%% ^^!
note

Notice that ^ and % require extra escaping

Adding Color to Your Banner

You can add color to make your banner stand out even more.

Simple Method: The COLOR Command

The COLOR command sets the background and foreground color for the entire window.

@ECHO OFF
COLOR 0A
ECHO This entire window is now green text on a black background.
  • 0 = Black background, A = Light Green foreground.

Advanced Method: ANSI Escape Codes

On modern Windows 10/11 systems, you can use ANSI escape codes to color individual pieces of text. This is a very advanced technique and can be complex. It involves echoing a special "escape" character. This is often too complex for a simple batch file and is better handled by a helper script or a different language.

Practical Example: A "Welcome" Banner for a Utility Script

This script displays a clean, professional-looking banner when it starts. It uses a font that contains the | character, so they must be escaped.

Let's use a simpler, more robust example that requires escaping:

@ECHO OFF
REM Welcome Banner Generator
REM Uses ASCII art with properly escaped vertical bars

:: Clear screen for cleaner presentation
CLS

:: Display banner with escaped vertical bars
ECHO ^|^|================================================^|=================^|
ECHO ^|^| WELCOME TO ^| ^|
ECHO ^|^| UTILITY SCRIPT v1.0 ^| ^|
ECHO ^|^|================================================^|=================^|
ECHO ^|^| Purpose: Your utility description here ^| ^|
ECHO ^|^| Author: Your Name ^| ^|
ECHO ^|^|================================================^|=================^|

PAUSE

Conclusion

Using an ASCII art banner is a simple and effective way to improve the look and feel of your batch scripts.

The process is straightforward:

  1. Generate your text using an online ASCII art generator.
  2. Paste the art into your script and prefix each line with ECHO.
  3. The most critical step: Escape every special character (& | < > ^ % !) with a caret (^) to prevent your script from breaking.