BS0小陈 当前离线
一级士官
@echo off setlocal enabledelayedexpansion for /f "delims=" %%a in (1.txt) do ( set d=%%a call:a ) echo.!num! pause :a set n=!d:~0,1! if "!d!"=="" goto:eof set d=!d:~1! if "!n!"=="a" ( set /a num+=1 echo !num! !d! goto :a)复制代码
garyng (GaryNg)当前离线
少尉
TOP
FOR 当前离线
中尉
CrLf 当前离线
论坛巡查
@echo off&setlocal enabledelayedexpansion for /f "delims=" %%a in (1.txt) do ( set tmp=%%aa set tmp=!tmp:"=! set tmp=!tmp:a=" "a! for %%a in ("!tmp!") do set /a n+=1 set /a n-=2 ) echo 1.txt 中有 !n! 个 a pause复制代码
@echo off setlocal enabledelayedexpansion for /f "delims=" %%a in (1.txt) do ( set d=%%a call:a ) echo.!num! pause :a set n=!d:~0,1! if "!d!"=="" goto:eof set d=!d:~1! if "!n!"=="a" ( set /a num+=1 echo !num! !d! ) goto :a复制代码