请各位大哥指教,为什么这段代码遍历最外层第一个文件夹后就结束了。
setlocal enabledelayedexpansion
for /f %%i in ('dir /ad /b')do (
for /f %%j in ('dir /ad /b %%~dpi%%i')do (
set n=0
for /f %%k in ('dir /a-d /b %%dpi%%i\%%j\*.txt
)do ( set /a n=!n!+1
for /f "delims=" %%i in ('dir/ad/b "%cd%\*.*"')do for /f "delims=" %%j in ('dir/ad/b "%cd%\%%~nxi\*.*"')do (
set n=0
for /f "delims=" %%k in ('dir/a-d/b "%cd%\%%~nxi\%%~nxj\*.txt"')do (
for /f "delims=" %%k in ("%cd%\%%~nxi\%%~nxj\%%k")do (
set /a n+=1
echo,"%%~nxi\%%~nxj" !n!: "%%~fk"
)
)
)作者: wangxiaodong 时间: 2018-1-6 18:50