Deleting specific line in file using batch script -


i found out batch script not working properly. wanted write function deletes specific line in file, code:

:unmark     type %markpath% | findstr /b /v %1 > %markpath_copy% goto:eof 

yes, works, writes new content (without specific lines) in new file. instead of it, want overwrite existing file. that:

:unmark     type %markpath% | findstr /b /v %1 > %markpath% goto:eof 

but it's not working, file empty after code execution. can me figure out problem , how solve it?

this style should work:

@echo off set "markpath=%userprofile%\desktop\input.txt" set "markpath_copy=%userprofile%\desktop\searchfile.txt"  findstr /b /v "%~1" <"%markpath%" > "%markpath_copy%" move /y "%markpath_copy%" "%markpath%" >nul 

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -