Loading Effect in Batch

66,482

16

51

Introduction: Loading Effect in Batch

This is second instructable .. so still go easy on me .. ty

This script is a loading script .. well it only looks like one , it doesn't actually load anything .. its if you just want the effect of something in a batch file to seem like it is loading ...
I will give you the script and i will show you how i did it ...
please leave a comment about what you thought ... Thanks

Also because of how awesome El Mano is =P
somewhere on the comments he has posted a better version of this..
Thanks El Mano =D .. saves me the work of posting it.

Step 1: Steal My Script

OK if you can't be bothered to see how it works then you can just steal my script . I attached it . so you will have to delete one of the 'b's off the file extension for it to be readable.. and you will have to edit what it says at the top of the script .. and remove the 'By iRule' at the bottom of the script.. if something doesn't work please pm me or leave a comment...

Step 2: How It Works

OK this is a pretty simple script ..
All it uses is:
ping localhost -n 2 >nul = pause for X seconds - i paused for 2 here
cls = clear the batch screen
echo = to display the loading bar and writing

All the script dose is:
display loading at 0
pause for X seconds
Clear screen
Display loading at 5
and it keeps doing this untill its at 100
pretty simpe eh?

Hope you liked it ... please comment and pm me with any question .....

Be the First to Share

    Recommendations

    • Battery Powered Contest

      Battery Powered Contest
    • Plywood Challenge

      Plywood Challenge
    • Plastic Contest

      Plastic Contest

    51 Discussions

    0
    gamers lab
    gamers lab

    3 years ago

    2 things

    one is the ping command safe because last time I used ping in my batch code for my custom made ai system it deleted my ability to use Bluetooth on my laptop

    2 I've got a challenge. the challenge is, try and create a loading screen without using ping

    0
    lucaballardini
    lucaballardini

    Reply 6 months ago

    wow welcome to the world of M$

    0
    DavorJ2
    DavorJ2

    Reply 2 years ago

    sleep 2

    0
    GoWolves11
    GoWolves11

    Reply 3 years ago

    Yes, I agree, no offense but I don't trust the ping localhost part.

    0
    CoenW1
    CoenW1

    5 years ago on Introduction

    Why do you use the ping command? You better use the timeout command

    timeout -t 2 >NUL

    0
    WildOne1985
    WildOne1985

    Reply 5 years ago on Introduction

    Because the timeout command (after what I've read) doesn't really do things in exactly the amount of seconds it's supposed to do. Many will swear to to using ping as well because it uses less processor power (hardly an issue today). In the end it really doesn't matter; use whatever works!

    0
    DavorJ2
    DavorJ2

    Reply 2 years ago

    Just use sleep 2

    0
    AshrafK18
    AshrafK18

    4 years ago

    dude, i want to ask something, how can i make multiple progress bar, i already copied the code 3 times but the first progress bar always got erased, i want it to have 3 progress bar when done, care to tell me which i should add??

    0
    xlan
    xlan

    4 years ago

    A good

    0
    The AleeD
    The AleeD

    5 years ago

    Thanks Now I used it for my OS :)

    0
    bigjeff5
    bigjeff5

    5 years ago on Introduction

    Similar to the one El Mano posted, but with the percentage in the progress bar. Where it says <40 spaces> you need to add 40 spaces, because these comments strip them out:

    @echo off

    color 0A

    set "progbar= <40 spaces>"

    set /a pct=0

    :top

    cls

    echo(

    echo Loading...

    echo ---------------------------------------------

    echo %progbar% %pct%%%

    echo ---------------------------------------------

    ping localhost -n 2 > nul

    set progbar=[]%progbar:~0,-2%

    if %pct%==100 goto end

    set /a pct=%pct%+5

    goto top

    :end

    echo Done^^!!

    pause

    0
    bigjeff5
    bigjeff5

    5 years ago on Introduction

    Just saw it didn't copy "set progbar=" correctly, that line has 40 spaces between = and ".

    0
    KenshinH
    KenshinH

    5 years ago on Introduction

    You could use a for loop or just make a variable (that is the percentage of what is loaded already) and increase it by 5 and check to see if it is at 100. When it reaches 100, then the loop stops and goes to whatever it needs to do.

    Example:

    echo off

    color 0A

    mode 300

    ::/\ You don't have to put this line in

    cls

    set /a "percent=0"

    set /a "loaded="

    :A

    echo Loading... Please wait

    echo ---------------------------------------

    echo %loaded% = %percent%% ]

    echo ---------------------------------------

    set /a "percent=%percent%+5"

    set /a "loaded=%loaded%+'|'"

    :B

    ::Whatever you need to do after it loads...

    You get the idea, right? This isn't perfect. Don't copy it into your editor and run it because the program doesn't work, but the idea does.

    0
    Arbitror
    Arbitror

    11 years ago on Introduction

    I think that this is pointless in a actual batch program where you want to get something done. But, It would be good in a batch movie. If I were going to put a loading command, then I would actually make the loading screen real. For instance, It would only show for the amount of time to load, with you can do with the call command.

    0
    WildOne1985
    WildOne1985

    Reply 5 years ago on Introduction

    It would be useful if you were making a script for a customer who isn't really tech savvy and you wanted to show the progress so that he/she doesn't think the program has stalled. In example a backup script where each 10% takes about, say, three minutes.

    0
    iRule
    iRule

    Reply 11 years ago on Introduction

    cheers I think ? ... i know it would be pretty pointless in an actual script but i thought that might come useful to someone like someone making a movie

    0
    El Mano
    El Mano

    11 years ago on Step 1

    This is a cool program, but it takes up a lot of space, making your file large and hard-to-edit. This is a much shorter, if more complicated, way:

    @echo off
    title Loading... By El Mano
    color 0a
    set load=
    set/a loadnum=0
    :Loading
    set load=%load%()
    cls
    echo.
    echo Loading... Please Wait...
    echo ----------------------------------------
    echo %load%
    echo ----------------------------------------
    ping localhost -n 2 >nul
    set/a loadnum=%loadnum% +1
    if %loadnum%==20 goto Done
    rem You can set the number of ()'s as whatever you rem want but remember: in your "loading box" you rem need 2 spaces for every () because "()" takes up rem 2 spaces. The above box has 40 spaces, so rem twenty repeats, adding 1 () every repeat.
    goto Loading
    :Done
    echo.
    pause
    rem *your action here*
    exit

    Feel free to modify, use, or ignore this. It's not copyrighted.

    0
    power5000
    power5000

    Reply 8 years ago on Introduction

    Hi i know this was all the way back in 2009 but I was wondering if you could explain this a little bit i dont understand the
    " set load=%load%"
    why not just
    "set load=()"?