Advertisement
T3RRYT3RR0R

Batch Parallel & Sequential Subprogram launcher

Jan 14th, 2020
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.56 KB | None | 0 0
  1. @ECHO OFF
  2. TITLE %~n0
  3.  
  4. :: REM Each subrograms path to be run in parallel is to be passed as parameters to the launch function.
  5. :: REM Sequential Launching is achieved with Additional instances of Call with parameters
  6.  
  7. CALL :Launch "program1_1.bat" "program1_2.bat" "program1_3.bat"
  8. CALL :Launch "program2_1.bat" "program2_2.bat" "program2_3.bat"
  9.  
  10. ECHO Subs Complete
  11. PAUSE >nul
  12. EXIT
  13.  
  14. :Launch
  15. FOR %%a IN (%*) DO (
  16.     START "+++batch+++" "%%~a"
  17. )
  18.  
  19. :Loop
  20.     TIMEOUT /T 1 >nul
  21.     TASKLIST /FI "windowtitle EQ +++batch+++*" |FIND "cmd.exe" >nul && GOTO :Loop
  22. GOTO :EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement