The Amazing Progress Bar in CMD

Introduction: The Amazing Progress Bar in CMD

One of the best things I have always loved about Microsoft Windows is the progress bar. Although, there has been a lot of changes in mordern times, I am going to teach you how to create the classic windows XP setup screen.

The colors we would be using is the classic yellow progress bar on a blue screen.

Note the following colors down;


Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Understanding the Anatomy of Progress Bars

A progress bar is an indicator for the user to know the rate at which a setup is being carried out. It does help estimate the times. So it is indication of rate of transfer from start to the end.

Rate = Distance/Time in other words Transfers /Time.

Step 2: Let's Dive Into the Code

As usual launch your favorite windows notepad. Click start and type notepad or click the Windows Key + R to launch run and then type notepad.

Write the following lines. (This is the foundation in creating a progress bar effect);

  • @echo off
  • echo.
  • cls
  • echo.
  • echo.
  • echo
  • Counting 1.
  • echo ----------------------------------
  • echo 1
  • echo ----------------------------------
  • ping -n 3 localhost >nul
  • cls
  • echo.
  • echo.
  • echo Counting 2..
  • echo ----------------------------------
  • echo 2
  • echo ----------------------------------
  • ping -n 3 localhost >nul
  • cls
  • echo.
  • echo.
  • echo Counting 3...
  • echo ----------------------------------
  • echo 3
  • echo ----------------------------------
  • ping -n 3 localhost >nul

Step 3: Customizing Code to Match Your Favorite Progress Bar

Open your Command Prompt and try which colors would work for your progress bar.

Remember to take a darker background and a lighter foreground or the other way round for your progress bar.

Type color /? and that would yield results such as the following;

Sets the default console foreground and background colors.
COLOR [attr]

attr Specifies color attribute of console output

Color attributes are specified by TWO hex digits -- the first corresponds to the background; the second the foreground. Each digit can be any of the following values:

0 = Black 8 = Gray

1 = Blue 9 = Light Blue

2 = Green A = Light Green

3 = Aqua B = Light Aqua

4 = Red C = Light Red

5 = Purple D = Light Purple

6 = Yellow E = Light Yellow

7 = White F = Bright White

If no argument is given, this command restores the color to what it was when CMD.EXE started. This value either comes from the current console window, the /T command line switch or from the DefaultColor registry value.

The COLOR command sets ERRORLEVEL to 1 if an attempt is made to execute the COLOR command with a foreground and background color that are the same.

Example: "COLOR fc" produces light red on bright white


Step 4: Download the Amazing Progress Bar

Here you have, the amazing Windows XP progress bar. Start playing with progressive dots for example one dot represents a progress and two dots represents a progressive transition.

If you are happy with the code, do well to leave your feedback. I would be creating 24 Hours CTU styled screens with many adavanced parts shortly. Stay tuned and don't tell anyone you can create the amazing progress bar.

PS: Download the Bonus ECG script and make modifications. I would like to see what you can come up with.

You could get a shorter progress bar script. See the PBonus file.

See ya!

Be the First to Share


    • Backyard Contest

      Backyard Contest
    • Silly Hats Speed Challenge

      Silly Hats Speed Challenge
    • Finish It Already Speed Challenge

      Finish It Already Speed Challenge

    4 Discussions


    2 years ago

    My version of a progress bar

    What about my variant without clear screen and percentage (not needed since it's a progress bar)

    @echo off


    setlocal EnableExtensions EnableDelayedExpansion

    :: set console size

    mode con: cols=80 lines=50

    :: set console color

    color 1e

    :: Set carriage return

    for /F %%# in ('copy "%~f0" nul /z') do set "_CRET=%%#"

    :: Check console dimensions

    set "_HEIGHT=" && for /f "skip=3 tokens=2" %%# in ( 'mode con:' ) do ( if not defined _HEIGHT set /a "_HEIGHT=%%#-2" )

    set "_WIDTH=" && for /f "skip=4 tokens=2" %%# in ( 'mode con:' ) do ( if not defined _WIDTH set /a "_WIDTH=%%#-2" )

    set "_OLD_PERC=0" && set "_PERC=0"

    :: Goto bottom

    for /l %%# in ( 1, 1, %_HEIGHT% ) do echo(

    ::Draw line

    set "_LIN=" & for /l %%# in ( 1, 1, %_WIDTH% ) do ( set "_LIN=!_LIN!_" )

    echo( !_LIN!

    :: Draw empty progress bar

    set "_LIN=" & for /l %%# in ( 1, 1, %_WIDTH% ) do ( set "_LIN=!_LIN!²" ) & <nul set /p "=!_LIN!!_CRET! "

    :: Fill progress bar

    for /l %%# in ( 0, 1, 100 ) do (

    set "_OLD_PERC=!_PERC!"

    set /a "_PERC=%_WIDTH%"*%%#/100

    if !_OLD_PERC! neq !_PERC! <nul set /p "=Û"

    >nul ping -n 1 localhost



    >nul pause

    goto :eof


    2 years ago

    It was useful for me, thank you for sharing.


    4 years ago on Introduction

    I love this It is so useful I did some editing so it would loop and be a bit faster and put it on my moms laptop i told her it was updating LOL