@echo off
setlocal enabledelayedexpansion
for %%a in (*.txt) do (
set "file=%%a"
set /p name_a=<"%%a"
call :nameb
ren "%%a" "!name_a!!name_b!.txt"
)
echo ok
pause>nul&exit
:nameb
for /f "skip=1 tokens=* delims=" %%c in ('type "!file!"') do set "name_b=%%c"&goto :out
:out
for /f "skip=2 tokens=* delims=" %%c in ('type "!file!"') do set "line_c=%%c"&goto :next
:next
findstr /V "!line_c!" "!file!">#
move # "!file!"