Output the results of two commands in parallel

Microsoft Windows
Post Reply
Blitz
Posts: 2
Joined: 2021-Oct-09, 9:28 pm

Output the results of two commands in parallel

Post 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
User avatar
Manna5
Posts: 14
Joined: 2021-Aug-03, 7:54 am
Contact:

Re: Output the results of two commands in parallel

Post by Manna5 »

Can you include an explanation? This long single-line FOR loop in Parallel.bat is hard to read.
Post Reply