-1

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

Haakon
  • 1

1 Answers1

0

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
Nathan Tuggy
  • 2,237
  • 27
  • 30
  • 38
  • 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) – Stephan Nov 29 '15 at 21:05