我不明白这背后的逻辑。我有11个 .cmd
文件,需要按照一定的顺序运行。其中5个文件可以同时启动,接下来的5个文件直接依赖于前5个文件的对应,最后一个文件依赖于第二组5个文件的运行。
QAQC
流程1-5。CONVERT
进程中,每个 QAQC
流程完成后,再进行处理。CONVERT
流程已经完成。我想我需要做一个 .cmd
或 .bat
文件,然后在一个文件中调用这5个文件。
file1.cmd
:
call QAQC1
call CONVERT1
file2.cmd
:
call QAQC2
call CONVERT2
以此类推...
最后的文件会是这样的
FINAL_FINAL.cmd
:
start "QAQC1.cmd" QAQC1.cmd
start "QAQC2.cmd" QAQC2.cmd
start "QAQC3.cmd" QAQC3.cmd
start "QAQC4.cmd" QAQC4.cmd
start "QAQC5.cmd" QAQC5.cmd
我仍然不清楚这样做是否正确,或者我如何在调用最终文件之前完成所有这些步骤,将所有东西合并在一起,并要求所有其他10个文件完成。任何帮助将是非常感激的
@echo off
setlocal enabledelayedexpansion
for /l %%a in (1,1,5) do (
set /a x=!random! %% 10
>QAQC%%a.cmd (
echo @echo QAQC%%a
echo @timeout !x!
)
>CONVERT!%%a.cmd (
echo @echo CONVERT%%a
echo @timeout !x!
)
)
echo @echo merge running >merge.cmd
echo @timeout 3 >>merge.cmd
REM ignore anything before this line; it just creates a test environment
@echo off
echo wait for qaqcX and convertX to finish...
( start cmd /c "qaqc1.cmd & convert1.cmd"
start cmd /c "qaqc2.cmd & convert2.cmd"
start cmd /c "qaqc3.cmd & convert3.cmd"
start cmd /c "qaqc4.cmd & convert4.cmd"
start cmd /c "qaqc5.cmd & convert5.cmd"
) | pause >nul
call merge.cmd
echo done.