- @echo off
- for /f "delims=" %%a in ('dir /a-d/b *.txt') do call :r "%%a"
- pause&exit
- :r
- setlocal enabledelayedexpansion
- set n=1
- for /f "tokens=1* delims=:" %%b in ('findstr /n "★.*★" "%~1"') do (
- if !n! geq 2 (
- >nul 2>&1 set /a "1/(%%b-line-1)"||(
- echo;del /f /q "%~1"
- goto :eof
- )
- )
- set "line=%%b"
- set /a n+=1
- )
复制代码
|