Loading Effect in Batch





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 .....



    • Science of Cooking

      Science of Cooking
    • Pocket-Sized Contest

      Pocket-Sized Contest
    • Trash to Treasure

      Trash to Treasure

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




    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

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

    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??


    A good

    Thanks Now I used it for my OS :)

    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




    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


    echo Done^^!!


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

    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.


    echo off

    color 0A

    mode 300

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


    set /a "percent=0"

    set /a "loaded="


    echo Loading... Please wait

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

    echo %loaded% = %percent%% ]

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

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

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


    ::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.

    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.

    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.