文本内容不能含有半角 ! 号
:- @echo off & setlocal enabledelayedexpansion
- for /f "delims=" %%a in ('findstr /n .* a.txt') do (
- set str=%%a
- set str=!str:*:=!
- if not defined str (echo;) else (
- if /i "!str:~0,9!"=="allcount=" (set num=allcount) else (
- if defined num echo !num!=!str:~8!&set "num="
- echo !str!
- )
- )
- )
- pause
复制代码
|