【问题标题】:Batch - run same command depending on the output批处理 - 根据输出运行相同的命令
【发布时间】:2014-07-01 16:05:49
【问题描述】:

我有一个 Windows 批处理,它知道一次处理 100 个文件并在处理后将它们移动到某个地方。 (不能修改)
如果进程无法找到更多文件,则返回“没有更多文件”
如果进程能够处理它返回“进程正常”


我想在包含大量文件的文件夹上连续使用不同的批处理文件运行该过程
如何读取和比较第一批的值以确定是否需要再次运行相同的命令?
在这种情况下我应该使用 GOTO 还是 while 循环?

do
   first batch
while (first batch output != 'no more files')

【问题讨论】:

  • 为什么需要一次处理100个文件? robocopy 似乎是一个很好的解决方案,因为它具有自动重试、带宽限制等功能。
  • 批次存在且无法修改,因为它调用了另一个系统。

标签: batch-file batch-processing


【解决方案1】:
:do
   rem first batch
   for /F "delims=" %%a in ('firstBatch.bat') do set output=%%a
rem while (first batch output != 'no more files')
if "%output%" neq "no more files" goto do

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多