简体   繁体   中英

Windows Batch file execute X files at a time

I have this code in my batch file:

@echo off
set real_parent_path=%1%
for %%F in (%real_parent_path%*.*) do call set files=%%files%% %%F

START cmd.exe /k "cd S:\Production\CrushFTP7_PC\modules\photomatixpro5 & PhotomatixCL -z -Z AA8E67A0 -x "S:\Production\CrushFTP7_PC\modules\photomatixpro5\BuiltinPresets\LCP360_settings.xmp" -mp 8 -a2 -am 12 -tr -r 11  -n 0  -ns 0 "_HDR" -bi 8 -h remove -s jpg -d %real_parent_path%HDR\\%files%"

%files% contains a list of all the files in the working folder, how would I send 3 files at a time to the START command?

Given your feedback in the comments - I might do something like the following

@echo off

setLocal enableDelayedExpansion
set real_parent_path=%1%
set count=0
set "files="

for %%F in (%real_parent_path%*.*) do (
    set /a count+=1
    set files=!files! %%F
    if !count!==3 (
        START cmd.exe /k "cd S:\Production\CrushFTP7_PC\modules\photomatixpro5 & PhotomatixCL -z -Z AA8E67A0 -x "S:\Production\CrushFTP7_PC\modules\photomatixpro5\BuiltinPresets\LCP360_settings.xmp" -mp 8 -a2 -am 12 -tr -r 11  -n 0  -ns 0 "_HDR" -bi 8 -h remove -s jpg -d %real_parent_path%HDR\\!files!"
        set count=0
        set "files="
    )
)

Run the start command inside the for loop, every third iteration - then clear the files variable, and continue the loop.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM