- @echo off&setlocal enabledelayedexpansion
- set "space= "
- :lp
- for /f "delims=" %%a in ('dir/b %1') do (
- if /i "%%~fsa" neq "%~fs0" if exist "%%a\" (
- call :lp "%%a"
- ) else (
- if /i "%%~xa" equ ".txt" set/a #%~1+=1&set "_%~1=!_%~1!"%%a" "
- ))
- set/a m=0
- (echo %~1目录中有!#%~1!个文本文件:
- for %%i in (!_%~1!) do (
- set/a m+=1,mod=m%%5,x+=1
- set "var=%%~i%space%"
- set/p=!var:~,10! <nul
- if !mod! equ 0 echo.
- )
- echo.&echo.)>>list.txt
- if "%~1" equ "" echo %~dp0中共有%x%个文本文件>>list.txt&start list.txt
复制代码
- @echo off&setlocal enabledelayedexpansion
- set "space= "
- for /r %%a in (*.txt) do (
- set "pat=%%~dpa"&set "pat=!pat:~,-1!"
- for %%i in (!pat!.tmp) do set "_%%~ni=!_%%~ni!"%%~nxa" "&set/a .%%~ni+=1
- )
- for /f "tokens=1* delims==_" %%a in ('set _') do (
- set m=0
- echo %%a中共有!.%%a!个文本文件:
- for %%i in (%%b) do (
- set "x=%%~i%space%"
- set/a m+=1,mod=m%%5,c+=1
- set/p=!x:~,10! <nul&if !mod! equ 0 echo.
- )
- echo.&echo.
- )>>list.txt
- echo %~dp0中共有%c%个文本文件>>list.txt
- start list.txt
复制代码
- @echo off&setlocal enabledelayedexpansion
- set "space= "
- for /r %%a in (*.txt) do set ".%%~pa=!.%%~pa!"%%~nxa" "&set/a _%%~pa+=1
- for /f "delims==." %%a in ('set .') do (
- set "var=%%a"&set n=0
- echo !var:%~p0=!中有!_%%a!个文本文件:
- for %%i in (!.%%a!) do (
- set "str=%%~i%space%"
- set/a n+=1,mod=n%%5,c+=1
- set/p=!str:~,10! <nul
- if !mod! equ 0 echo.
- )
- echo.&echo.
- )>>list.txt
- echo %~dp0中共有%c%个文本文件。>>list.txt
- start list.txt
复制代码
|