loading screen batch file

@echo off
    setlocal enableextensions enabledelayedexpansion

    Rem Get a carriage return character
    set "CR=" & for /f %%a in ('copy /Z "%~f0" nul') do if not defined CR set "CR=%%a"
    rem The progress bar
    set "fill=[##########]"

    cls
    echo(:: computers were created to give humans time to think while waiting ....

    rem For each character in the fill
    for /l %%a in (2 1 11) do (
        rem Calculate the right part of the bar
        set "spaces=!fill:~%%a!"

        rem Output the left and right parts of the bar and carriage return
        <nul set/p ".=:: Loading something big !fill:~0,%%a!!spaces:#= !!CR!"

        rem Pause for a second
        ping -n 2 "" > nul
    )
    echo(
    echo(:: Done

5
3
Moooooooooo 100 points

                                    @echo off
    setlocal enableextensions enabledelayedexpansion

    for /l %%a in (0 10 100) do (
        call :loadingScreen %%a
        &gt;nul ping -n 2 &quot;&quot; 
    )
    echo(:: Done
    goto :eof

:loadingScreen percent
    setlocal enableextensions enabledelayedexpansion

    rem Prepare everything 
    set    &quot;sb=+----------+&quot;
    set &quot;fill=^|##########^|&quot;
    set    &quot;eb=+----------+&quot;
    set /a &quot;chars=2+%~1/10&quot;
    set &quot;spaces=!fill:~%chars%!&quot;
    set &quot;loadBar=!fill:~0,%chars%!!spaces:#= !&quot;

    rem Time to paint
    (   cls
        echo(:: computers were created to give humans time to think while waiting .... %time%
        echo(
        echo(                           %sb%
        echo(     Loading something big %loadBar%
        echo(                           %eb%
        echo(
    ) 
    goto :eof

5 (3 Votes)
0
Are there any code examples left?
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source