|To search for a line in a text file, then delete it. Use this.|
Example text file
And another line
SET /p search=Search:
FIND "%search%" FILE.txt
IF ERRORLEVEL 1 Goto :NOTFOUND
echo Record Found, Press Y to confirm deletion. Y/N
set /p YN=Y/N ? :
IF %YN% == Y goto :DELETE
IF %YN% == N goto :QUIT
FINDSTR /v /i "%search%" < FILE.txt > FILE2.txt
REN FILE2.txt FILE.txt
First you enter a string, if it finds it in the file it will ask to confirm the delete and display the entire line.
When you enter Y, it will copy everything other than the searched string into a new txt file(FILE2.txt) then delete the original, then rename the new file back to the old.
So you end up with the same file but the searched string line removed.
And just another note, using the example text file above, if you search "line". It would display and delete both of the lines which have the word line in.
Hope that helps.
You have WinXP as your OS. The code above was used on an XP machine so it should work, It doesn't seem to work on Win7.