I am trying to write a batch file that does two things:
thank you! confirmed working on windows 10 cmd file. very useful way to create multiple aysnc tasks and sync them back up. For example, chkdsk multiple drives in parallel and wait for all jobs to finish:
C:\Windows\System32\schtasks.exe /RUN /TN "chkdsk_G"
C:\Windows\System32\schtasks.exe /RUN /TN "chkdsk_H"
:loop
for /f "tokens=2 delims=: " %%f in ('schtasks /query /tn chkdsk_G /fo list ^| find "Status:"' ) do (
if "%%f"=="Running" (
ping -n 60 localhost >nul 2>nul
goto loop
)
)
for /f "tokens=2 delims=: " %%f in ('schtasks /query /tn chkdsk_H /fo list ^| find "Status:"' ) do (
if "%%f"=="Running" (
ping -n 60 localhost >nul 2>nul
goto loop
)
)
:both jobs are now complete