0

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

Skipper
  • 5
  • 4
  • Cmd.exe's scripting language doesn't really lend itself to running multiple processes sharing the same console. You could write a batch that starts a bunch of processes in other windows and then do the status bar thing in a loop in the batch file. It's complicated by the fact that you'd have to parse output from something like tasklist in order to detect when those processes completed, and you really wouldn't have any clue exactly how far along any of the were. – jwdonahue Jan 02 '18 at 22:54
  • Please review [Ask] and [MCVE]. What are you planning to use for searching? – jwdonahue Jan 02 '18 at 22:55
  • @jwdonahue Thanks for your Answer... I know it's a really messy thing but I might have found a way; I'll post it here when i solved it. Actually the **searching** Code should just check if a file exist and move it. I know there's no progressing bar needed for such a fast action but it's about the principle ^^ – Skipper Jan 02 '18 at 23:12
  • the batch overhead for you want to do, might be higher than the workload. Good luck! – jwdonahue Jan 02 '18 at 23:15
  • 1
    Possible duplicate of [executing batch files parallel and wait till all completes](https://stackoverflow.com/questions/20755181/executing-batch-files-parallel-and-wait-till-all-completes) – phuclv Jan 03 '18 at 03:46

1 Answers1

0

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....
Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77