You will probably want the START command to initiate parallel processing, though it could be done via WMIC. Note that the first argument is treated as a window title if it is quoted. That is why my first argument is an empty string. The /B
option runs the command in the same window. Remove it if you want a new window for each command.
There is no simple native batch command or option to wait for a series of parallel processes to finish.
I like to redirect an unused file handle to a file for each process, thus establishing an exclusive lock. I can then detect if a process is still running by attempting to redirect (CALL )
(effectively a null op) to the same lock file. If the redirection fails, then the process is still running. Success indicates the process has terminated.
The test must be done against each of the lock files in a polling loop. Adding a delay is a good idea to prevent the polling loop from abusing resources.
@echo off
set "lock=%temp%\%~nx0.lock"
start "" /b "timeout" 5 9>"%lock%.1"
start "" /b "timeout" 8 9>"%lock%.2"
:wait
timeout 1 /nobreak >nul
2>nul (for %%F in ("%lock%.*") do 9>"%%F" (call ) && del "%%F" || goto :wait)
echo OK
If you have a large number of parallel processes to run, and you want to limit the number of simultaneous processes, then you may be interested in https://stackoverflow.com/a/11715437/1012053
wait-job
(technet.microsoft.com/en-us/library/Hh849735.aspx)