- @echo off
- for /f "delims=" %%a in ('type "文本.txt" ^| findstr /n .*') do (
- set "line=%%a"
- setlocal enabledelayedexpansion
- set "line=!line:*:=!"
- set "line2=!line:★★★★★=!"
- if not "!line2!" equ "!line!" (
- if not "!line2!" equ "★★★★★=" (
- set "line2=!line2:?=!"
- >xxx.temp echo !line2!
- )
- )
- set /p filename=<xxx.temp
- if "!line2!" equ "★★★★★=" (
- (echo,!line!)>>"!filename!.txt"
- )
- if "!line2!" equ "!line!" (
- (echo,!line!)>>"!filename!.txt"
- )
- endlocal
- )
- del xxx.temp
- pause
复制代码
我想了很久,还是利用了临时文件...通用性不大... |