loopsbatch-filewhile-looploadingsimultaneous

Batch file with loading Dots until command is executed


Okay so short question first

Is there any way to prevent creating loading bars with clearing the console and echoing it again? it would just make my life easier :)

What I want for output in Batch1...

File1 status : searching... (<--Dots as loading bar)
File2 status : searching. (<-- same here)


Second and more important question...
Can a Batch file actually run two commands simultaneously?
So that these loading Dots just appear while the Batch is executing the search command. Something like:

Do loop until Batch finished search

Or what i tried xDD...

for /l %%x in (1 , 1 , {search code} ) do {loading bar-code}

...yeah i know this code above could never work but at least I tried...

Thanks for helping ^^


Solution

  • Simultaneous tasks are impossible implement, as far as I know. But, just for fun, you can use fake loading dots with the following code:

    setlocal enabledelayedexpansion
        set "dot=."
        set "msg=initializing"
        for /L %%A in (1,1,4) do (
            set msg=!msg!%dot%
            echo !msg!
            timeout 1 >nul
            cls
        )
        echo !msg!
    

    Output:

    initializing....