回复 7# wangdao6699 - @echo off
- setlocal enabledelayedexpansion
- for /f "delims=" %%a in ('type "班级名册.txt"') do (
- set "str=%%a"
- set s=!s!"%%a";
- if "!str:~,2!" equ "班级" ((
- for %%i in (!s!) do (
- set "t=%%i"
- if "!t:~1,2!" equ "姓名" (echo,!t:~1,-1!
- ) else if "!t:~1,2!" equ "年龄" (echo,!t:~1,-1!)
- )
- echo,
- )>>"!str:~3!.txt"
- set s=
- ))
- pause
复制代码
|