title: Batch script to find and replace a string in text file without creating an extra output file for storing the modified file
body: <p>I have written a batch script to find and replace a string in a text file. Following is my script.</p>
  
  <pre><code>@echo off &amp;setlocal
  set "search=%1"
  set "replace=%2"
  set "textfile=Input.txt"
  set "newfile=Output.txt"
  (for /f "delims=" %%i in (%textfile%) do (
      set "line=%%i"
      setlocal enabledelayedexpansion
      set "line=!line:%search%=%replace%!"
      echo(!line!
      endlocal
  ))&gt;"%newfile%"
  del %textfile%
  rename %newfile%  %textfile%
  </code></pre>
  
  <p>I am able to replace the word successfully.</p>
  
  <p>But i dont want to create Output.txt and then rename it the original file..</p>
  
  <p>Please help me out for editing a text file without redirecting the output to a new file..</p>