PLC_Generation/run_all_compilations_parallel.bat
2025-09-02 11:13:29 +04:00

56 lines
2.0 KiB
Batchfile

@echo off
setlocal enabledelayedexpansion
echo ================================================================================
echo Parallel Compilation Script
echo ================================================================================
echo.
echo This script will find and run all batch files in generated_projects folders
echo in parallel, opening multiple command prompt windows.
echo.
set "generated_projects_dir=%~dp0generated_projects"
set "bat_count=0"
echo Scanning for batch files in: %generated_projects_dir%
echo.
REM Check if generated_projects directory exists
if not exist "%generated_projects_dir%" (
echo ERROR: generated_projects directory not found at: %generated_projects_dir%
pause
exit /b 1
)
REM Find all .bat files in subdirectories of generated_projects
for /d %%D in ("%generated_projects_dir%\*") do (
for %%F in ("%%D\*.bat") do (
set /a bat_count+=1
echo Found: %%F
echo Starting in new window: %%~nxF
REM Start each batch file in a new command prompt window
start "Compiling %%~nD" cmd /c "cd /d "%%D" && call "%%F" && echo. && echo Compilation finished for %%~nD && pause"
REM Small delay to prevent overwhelming the system
timeout /t 1 /nobreak >nul
)
)
echo.
echo ================================================================================
echo Started !bat_count! compilation processes in parallel windows
echo.
if !bat_count! equ 0 (
echo No batch files found in generated_projects subdirectories
) else (
echo Each compilation is running in its own command prompt window.
echo You can monitor the progress in the individual windows.
echo.
echo Note: The windows will remain open after completion so you can
echo review the results. Close them manually when done.
)
echo.
echo ================================================================================
pause