本帖最后由 cfwyy77_bat 于 2018-11-23 13:31 编辑
回复 6# 786021512
当前目录建了一个NEW文件来存放结果文件。- @echo off
- setlocal enabledelayedexpansion
- if not exist NEW mkdir NEW
- for /f "tokens=*" %%i in ('dir /b *.txt') do (
- for /f %%j in ('type "%%i" ^|find /c "PovL"') do set a=%%j
- for /f %%k in ('type "%%i" ^|find /c "PovP"') do set b=%%k
- set /a total=a+b
- (for /f "tokens=* delims=" %%l in (%%i) do (
- set "str=%%l"
- if "!str:~0,8!" =="(counter" ( echo;(counter,!total!)
- ) else ( echo;!str!)
- ))>.\NEW\%%i
- )
- pause
复制代码
|