在批处理脚本中以完全目录级别处理文件

时间:2020-02-13 08:17:33

标签: batch-file cmd

我一直在寻找针对bash命令的batch-file解决方案

for file in temp/*/*; do ... done

假设我有一个结构:

script.bat
temp
---- A
---- fileToExclude1
-------- 0
------------ SomeFile1
------------ SomeFile2
-------- 1
------------ SomeFile3
-------- 2
------------ SomeFile4
---- B
---- fileToExclude2
-------- 0
------------ SomeFile5
-------- 1
------------ SomeFile6
------------ SomeFile7
------------ SomeFile8
------------ SomeFile9
...

如何使用批处理脚本(或cmd行)中的模拟命令将文件(SomeFile1,SomeFile2,...,SomeFile9)处理为bash命令?

1 个答案:

答案 0 :(得分:0)

根据as a comment收到的Gerhard Barnard的建议,最终的解决方案是:

for /d %i in ("temp\*") do for /d %j in (%i\*) do for %k in (%j\*) do echo %k