Is there a simple equivalent to the following bash sequence in powershell or cmd (bat) ?
It is two blocks of 3 commands running in parallel, with a final 4th command in each block, both block beeing executed in parallel, then a final command is executed after both block completed.
(
(sleep 4; echo waited 4 ) &
(sleep 2; echo waited 2 ) &
(sleep 6; echo waited 6 ) &
wait
(sleep 1; echo waited plus 1 )
) &
(
(sleep 3; echo waited 3 ) &
(sleep 5; echo waited 5 ) &
(sleep 8; echo waited 8 ) &
wait
(sleep 2; echo waited plus 2 )
) &
wait
(sleep 1; echo waited 1 more finally)
which produces:
waited 2
waited 3
waited 4
waited 5
waited 6
waited plus 1
waited 8
waited plus 2
waited 1 more finally
I have found this https://stackoverflow.com/questions/71366320/in-powershell-how-to-wait-for-parallel-jobs-to-finish-before-proceeding which is the closest regarding synchronisation, but is not simple considering the imbrication needed.