How to Make Batch File Animations!

102,358

22

28

Posted

Introduction: How to Make Batch File Animations!

In this instructable I am going to show you how to make simple batch file animations.
Similar to "The Star Wars" batch.

So lets Get Started!

Step 1: The Bouncing Ball

The Bouncing Ball!

After seeing the "Batch Star Wars" I decided to make The Bouncing Ball a simple batch that I coded in my free time (during school study halls).
This was my first attempt at an animation in batch.
After about a 5 days of trial and error. I got it working.

So now im going to show you how to make one yourself.

Step 2: The Bouncing Ball Code and Explanation

Of Course you need some code to make this animation.

Just like a camera having frames or "pictures" to make a video batch Can be used the same way.

So we need to make a bunch of "pictures" for the batch file to display in an timed order.

Here is some example code of a bouncing ball....

echo -------------------
echo *
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo -------------------
ping localhost -n 1 >nul
cls
echo -------------------
echo.
echo *
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo -------------------
ping localhost -n 1 >nul
cls

The * is the ball. After every frame the ball moves one space down.

After Every "Frame" we use cls to clear the screen so its ready for the next "frame".

And ping localhost -n 1 >nul is a code used to pause the code just for a fraction of a second.

You can download my full bouncing ball Batch below.

Step 3: Party Time Batch!

Ah Yes The Party Time Batch!

Once again the "Party Time Batch" was a Batch I coded in my free time.

This batch is Still Suitable to be an "Animation". This is one of the most Fun batches I ever created.
This is Similar to the Bouncing Ball that they both have "Frames" but this one changes color.

Here is a Code Sample But Download the full batch.

:top
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo *********
echo *** ***
echo *** *** ******
echo ********* ****** **
echo *** *** ** * ** ** **
echo *** ** ** ****** ** ** **
echo *** ******* ** ** ** **
echo *** ** ** ** ** ** **
echo *** ** ** ** ** ** **
echo.
color 1a
ping localhost -n 0 >nul
color 2b
ping localhost -n 0 >nul
color 3c
ping localhost -n 0 >nul
color 4d
ping localhost -n 0 >nul
color 5e
ping localhost -n 0 >nul
color 6f
ping localhost -n 0 >nul
color 7a
ping localhost -n 0 >nul
color 8b
ping localhost -n 0 >nul
color 9c
ping localhost -n 0 >nul
goto time

Step 4: Post Your Creations!

Have Fun with this information.

If You Could Post Your Animations I would love to see how they came out.

Below Are the 2 Files Again.

Step 5: Upcoming.......

Right Now Im working on a Batch Pong!!!

Batch Pong Copyright 2009 I Got a Cup Productions.

Share

    Recommendations

    • Microcontroller Contest

      Microcontroller Contest
    • Science of Cooking

      Science of Cooking
    • Pocket-Sized Contest

      Pocket-Sized Contest
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    28 Comments

    how can i adjust the speed of moving , en make sound

    Bad Coding. Here is good coding (bounces foreverrrr)

    @ECHO off

    set ip=google.com

    set /A ms=50

    set direction=0

    set /A p=0+1

    goto main

    :DOWN

    CLS

    ECHO ______________________

    FOR /L %%G IN (1,1,10) DO (

    if "%%G" EQU "%p%" (

    ECHO ^| O ^|

    set /A p=%p%+1

    if "%p%" EQU "10" (

    set direction=1

    )

    ) else (

    ECHO ^| ^|

    )

    )

    ECHO ``````````````````````

    ping %ip% -n 1 -w %ms% >nul

    if "%p%" NEQ "11" goto DOWN

    set /A p=0+9

    goto main

    :UP

    CLS

    ::ECHO %direction%, %p%

    ECHO ______________________

    FOR /L %%G IN (1,1,10) DO (

    if "%%G" EQU "%p%" (

    ECHO ^| o ^|

    set /A p=%p%-1

    if "%p%" EQU "1" (

    set direction=0

    )

    ) else (

    ECHO ^| ^|

    )

    )

    ECHO ``````````````````````

    ping %ip% -n 1 -w %ms% >nul

    if "%p%" NEQ "0" goto UP

    set /A p=0+2

    goto main

    :main

    if "%direction%" EQU "0" goto DOWN

    if "%direction%" EQU "1" goto UP

    So looks like my spacing didn't come out right. You can probably figure it out tho

    Thank you for this tutorial because all i needed to remember was the ping localhost command!

    Hi everyone,

    Try this development environment for batch scripts, Batch Compiler ( http://bc.gotek.info ). It has everything you need to develop a batch program.And compile into stable stand alone executable (Exe).
    Specially Drawing Graphics in too easy with Batch Compiler.

    Friendly user interface.
    Debugger, Check your code for syntax errors.
    Powerful, versatile compiler.
    Allows mouse input in batch files.
    Use Windows Common Dialog Boxes.(BrowseFiles,BrowseFolders)
    Draw graphics in batch files.
    Reverse engineering proof encryption of source code.
    Include Company name, Copyright info and Version info.
    Make invisible(silent) executables.
    Executables with administrator privileges.
    Run & debug your script while editing.
    Embed resources with executable.(music,images,files)
    Advance Commands (BrowseFiles,LaunchSilent,MouseCMD)
    Stand-alone executables.No dependencies needed.
    Executables are woking on almost all windows operating systems.(98 to 10)

    Home : http://bc.gotek.info
    Quick download : http://bc.gotek.info/files/BatchCompiler1600.zip

    Hope this helps you.

    My movie wont work.Can you fix it?Here's the code:

    @echo off

    :a

    echo.

    echo 0

    echo l

    cls

    ping localhost -n 2 >nul

    echo.

    echo 0

    echo l

    cls

    ping localhost -n 2 >nul

    echo 0

    echo l

    cls

    ping localhost -n 2 >nul

    echo 0

    echo l

    cls

    ping localhost -n 2 >nul

    cls

    goto a

    Cool! I did something like this as well. May give you epilepsy tho

    What is epilepsy?

    http://bfy.tw/vTY