Page 1 of 1

Output the results of two commands in parallel

Posted: 2021-Oct-09, 10:15 pm
by Blitz
I hope this trick can help anyone

1.bat

Code: Select all

@echo off
for /l %%a in  (1,1,10) do echo=%%a
2.bat

Code: Select all

@echo off
for /l %%a in (1,1,15) do echo=%%a
Parallel.bat

Code: Select all

@echo off
(for /f "delims=" %%a in ('1') do @echo=%%a&ping 127.1 -n 1 >nul)|cmd /v /c "(for /f "delims=" %%b in ('2') do @(set/pa=&&echo=!a!		%%b||echo=		%%b))&&for /l %%c in (,,,) do @set /pa=&&echo=!a!||exit /b"
pause

Re: Output the results of two commands in parallel

Posted: 2021-Oct-12, 5:18 pm
by Manna5
Can you include an explanation? This long single-line FOR loop in Parallel.bat is hard to read.