@echo off FOR /D %%G in ("*") DO ( PUSHD "%%G" for /D %%A in ("*") DO ( PUSHD "%%A" FOR /F "delims=" %%H in ('dir /a-d /b * ^|find /C /V ""') DO echo %%G=%%H>>"....count.txt" POPD ) POPD ) pause
*可以换成任意的*.后缀名