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

64 lines
2.3 KiB
Batchfile

@echo off
setlocal enabledelayedexpansion
echo ================================================================================
echo Parallel Compilation Script (Silent Mode)
echo ================================================================================
echo.
echo This script will find and run all batch files in generated_projects folders
echo in parallel without keeping windows open.
echo.
set "generated_projects_dir=%~dp0generated_projects"
set "bat_count=0"
set "log_dir=%~dp0logs"
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 Create logs directory if it doesn't exist
if not exist "%log_dir%" mkdir "%log_dir%"
REM Get timestamp for log files
for /f "delims=" %%a in ('wmic OS Get localdatetime ^| find "."') do set "dt=%%a"
set "timestamp=%dt:~0,8%_%dt:~8,6%"
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
set "log_file=%log_dir%\compilation_%%~nD_%timestamp%.log"
echo Found: %%F
echo Starting: %%~nxF ^(logging to: !log_file!^)
REM Start each batch file in background, redirect output to log file
start /b "" cmd /c "cd /d "%%D" && call "%%F" > "!log_file!" 2>&1"
REM Small delay to prevent overwhelming the system
timeout /t 1 /nobreak >nul
)
)
echo.
echo ================================================================================
echo Started !bat_count! compilation processes in parallel (background mode)
echo.
if !bat_count! equ 0 (
echo No batch files found in generated_projects subdirectories
) else (
echo All compilations are running in the background.
echo Check log files in the 'logs' directory for progress and results.
echo Log files are named: compilation_[PROJECT]_%timestamp%.log
echo.
echo You can continue using this command prompt while compilations run.
)
echo.
echo ================================================================================