我建立批处理来统计1.txt中a出现的次数,不知道哪里出了错,求指教- @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)
复制代码
|