@echo off
goto :main
:choosestr
set string=%~1
set strstart=%string:~0,4%
set strend=%string:~-4%
if NOT %strstart%==%strend% echo %string%>>1.txt
goto :EOF
:main
set tpath=%tmp%/%RANDOM%%RANDOM%.tmp
type 1.txt>%tpath%
type nul>1.txt
FOR /F %%i in (%tpath%) do call :choosestr %%i