wh1234567 当前离线
上尉
for /f "delims=" %%i in (1.txt) do ( echo %%i>nul set /a a=a+1 ) echo. echo 统计结果:文本中共有 %a% 行! echo. pause复制代码
评分人数
CrLf 当前离线
论坛巡查
@echo off for /f "tokens=1* delims= " %%a in ('find /v /c "" *.txt') do for /f "tokens=1,2 delims=:" %%c in ("%%b") do ( set /a a+=%%d echo 文件“%%c”有%%d行 ren "%%c" "%%~nc【%%d行】.txt" ) echo;&echo 统计结果:文件中公用 %a% 行!^ pause复制代码
TOP
('find /v /c "" *.txt')漏了右单引号,已修改 zm900612 发表于 2011-5-21 16:43
find /c很好用,但是格式太讨厌...@echo off for /f "tokens=1* delims= " %%a in ('find /v /c "" *.txt) do for /f "tokens=1,2 delims=:" %%c in ("%%b") do ren "%%c" "%%~nc【%%d行】.txt" zm900612 发表于 2011-5-21 15:37
@echo off for /f "tokens=1* delims= " %%a in ('find /v /c "" *.txt') do for /f "tokens=1,2 delims=:" %%c in ("%%b") do ren "%%c" "%%~nc【%%d行】.txt"复制代码