如何递归遍历Windows批处理文件中的目录结构?
我在互联网上没有找到任何例子,除了作者在一个文本文件中列出所有目录,然后读取文本文件,进入目录并重复。
发布于 2013-11-07 19:58:43
查看FOR /R循环。
/R [驱动器:路径] %variable IN (设置) DO命令命令参数
Walks the directory tree rooted at [drive:]path, executing the FOR
statement in each directory of the tree. If no directory
specification is specified after /R then the current directory is
assumed. If set is just a single period (.) character then it
will just enumerate the directory tree.举个例子:
C:\>md dummy
C:\>cd dummy
C:\dummy>md foo
C:\dummy>md foo\bar
C:\dummy>for /r %i in (.);do @echo %igivs输出:
C:\dummy\.
C:\dummy\foo\.
C:\dummy\foo\bar\.https://stackoverflow.com/questions/19835112
复制相似问题