【问题标题】:Windows Batch file execute X files at a timeWindows 批处理文件一次执行 X 个文件
【发布时间】:2015-03-04 17:22:17
【问题描述】:

我的批处理文件中有这段代码:

@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% 包含工作文件夹中所有文件的列表,我如何一次将 3 个文件发送到 START 命令?

【问题讨论】:

    标签: windows batch-file cmd command-line-arguments


    【解决方案1】:

    鉴于您在 cmets 中的反馈 - 我可能会执行以下操作

    @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="
        )
    )
    

    在 for 循环中运行 start 命令,每三次迭代 - 然后清除 files 变量,并继续循环。

    【讨论】:

    • 'real_parent_path' 变量是从外部程序传递的。该代码工作正常,但是,它处理目录中的所有文件。我需要将变量分成 3 个一组并传递给 start 命令。感谢您查看代码!
    猜你喜欢
    • 2012-07-28
    • 1970-01-01
    • 1970-01-01
    • 2011-12-15
    • 1970-01-01
    • 2020-01-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多