FileForums (
-   Conversion Tutorials (
-   -   Multithreaded bat file (

Masquerade 05-06-2021 07:34

Multithreaded bat file
Hello everyone,

I have a bat file designed to carry out a task for all files in a folder via FOR command.

Currently, it only processes one file at once then moves onto the next file. For folders with, say, 200 items, this doesn't take long. However, it takes several hours to process large folders with several thousand items inside.

So, if I have 16 threads, is there any way to run the FOR task for 16 files at once all the way until all files are processed?

shazzla 05-06-2021 10:59

Maybe this workaround can help you a bit ?! :

Somewhere i read, batch programming is very basic,cant do multithreading as you want.
Or im wrong?!

Prince4 05-06-2021 11:10

You can create a batch file for each folder and run them all at once. With "Call" or "Start" i guess.

Edit : What shazzla said.

Joe Forster/STA 05-06-2021 11:20

This is the Unix bg command. It moves processes to the background - hence the name -, disconnecting their output from the console.

A more useful utility would be one that can launch command lines in the background. Try the built-in "start" command of Windows, with the options "/b" and "/min" and process priority, although it's not much. I use something like this when I want to compress multiple EXE's in the same directory with UPX.

None of these can synchronize the subprocesses, that is, make sure that exactly N subprocesses run at the same time and when one of them finishes, only then does the next one start.

panker1992 07-06-2021 04:54

i am using this for the past years and it works well :D

All times are GMT -7. The time now is 13:23.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.
Copyright 2000-2020, FileForums @