So i have this batch file that needs to delete a word in a txt file. it needs to delete the "addons" word at the end of this directory: D:\Batch Files\files\addons
1 Answer
This should work. It will create a new file though.
@echo off setlocal enabledelayedexpansion FOR /F "usebackq delims=" %%G IN ("Test.txt") DO ( Set "line=%%G" & echo !line:Pie=! )>>"Test2.txt 1 Comment
Stephan
you append to the same file, you are reading from. So it doubles your data. Better write to a new file (you can rename it afterwards, overwriting the original file, if needed)