Search code examples
windowsbatch-fileshellparallel-processingmulticore

Parallel execution of shell processes


Is there a tool available to execute several process in parallel in a Windows batch file? I have found some interesting tools for Linux (parallel and PPSS), however, I would need a tool for Windows platforms.

Bonus: It would be great if the tool also allowed to distribute processes in an easy way among several machines, running the processes remotely a la PsExec.

Example: I would like that in the following for loop

for %F in (*.*) do processFile.exe %F

a limited amount of instances of processFile.exe are running in parallel to take advantage of multi-core CPUs.


Solution

  • GNU xargs under Linux has a "-P n" switch to launch "n" processes in parallel.

    Maybe cygwin/mingw build of xargs also supports this?

    Then you can use:

    xargs -P 4 processFile < fileList
    

    No fancy multi-node process spawning, though.