- @echo off
- cd /d "%~dp0"
- @REM 多进程最大数量
- set procCount=4
-
- for /r "总文件夹" %%B in (*.b) do (
- call :sync
- echo %%B
- @REM 启动进程a.exe
- start "" a.exe "%%~B"
- )
- exit /b
-
- :sync
- @REM 检测进程a.exe的数量
- for /f "delims=" %%A in ('tasklist /fi "imagename eq a.exe" /fo csv /nh^|find /c ","') do (
- if %%~A geq %procCount% (
- ping -n 2 127.0.0.1
- goto sync
- )
- )
- exit /b
复制代码
|