Hi all I want to find and delete some word by a batch file i tried this:
@Echo OFF
REM Set These Variables
SET "InFile=Unloaded.txt"
SET "OutFile=NowLoaded.txt"
SET "Replace=%r%"
SET "ReplaceWith= "
REM Get Total Lines Number [including empty lines]
FOR /F %%A IN ('TYPE "%InFile%"^|find /v /c ""') DO SET "Till=%%A"
REM Create The OutFile with changes
SETLOCAL EnableDelayedExpansion
<"!InFile!" (
FOR /L %%a IN (1 1 0) DO SET /p "="
FOR /L %%A IN (1 1 %Till%) DO (
SET "line="
SET /P "line="
IF "!line!x" == "x" ( Echo.
) ELSE ( Echo !line:%Replace%=%ReplaceWith%!)
)
)>>"%OutFile%"
ENDLOCAL
but in out put instead of delete that says Echo Is Off. please help me thanks.
Take a look at replacer.bat.You can use it by like this to delete a word in text file:
More powerful solutions are JREPL.bat and FindRepl.bat.