我有 2 个批处理文件。
第一个需要一个输入参数,它是父文件夹的路径。它读取父文件夹中所有子文件夹的名称,并为每个子文件夹执行第二个批处理文件。
批次文件 1
@echo off
for /d %%Y in (%1/*) do (
set SubfolderNameAndPath=%%Y
call batch2.bat %SubfolderNameAndPath%
)
第二个批处理文件使用 SubfolderNameAndPath 作为输入参数,并对每个子文件夹中存在的所有文件执行 Evaluate.exe。它将 Evaluate.exe 的结果保存到文本文件“结果”中,该文件的扩展名带有每次访问的子文件夹的名称。( results_%~n1.txt
)。
批处理文件 2
@echo off
for %%X in (%1/*) do (
echo Evaluate.exe %%X AnotherArgumentHere -o results_%~n1.txt
)
当我运行 batch1 ( batch1.bat ParentFolderPath
) 时,即使它似乎调用了 batch2.bat,batch2.bat 也不会执行。我相信我为 batch2.bat 定义输入参数的方式出了点问题,但我无法弄清楚它是什么。
%SubfolderNameAndPath%
不包含任何空格。文件夹的路径都没有。我真的很感谢你在这方面的帮助。