The Amazing Progress Bar in CMD
by samueloppong in Circuits > Computers
77818 Views, 37 Favorites, 0 Comments
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;
1E.
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.
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
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
C:\>
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!