title: Store Multiline String in Batch Variable
body: <p>I need to remove a string that may occur inside a file. The string has many lines. <strong>Can I perform this action using a Batch script?</strong></p>
  
  <p>I've heard that you cant have variables with more than one line in Batch? The string will come from another file that I will read into a variable using Batch.</p>
  
  <p>The following code seems to only store the 1st/last line of a file in the string?? Whats going wrong?</p>
  
  <pre><code>Rem Read file and store all contents in string
  Set replace=
  Set target=
  Set OUTFILE=res.txt
  for /f "delims=" %%i in (myFile.txt) do set target=%target% %%i
  
  echo %target%
  Rem When I print target I only have one line not many lines?? Whats going wrong
  
  Rem Remove the target string from myOtherFile.txt: this code is from http://stackoverflow.com/questions/5273937/how-to-replace-substrings-in-windows-batch-file
  for /f "tokens=1,* delims=¶" %%A in ( '"type myOtherFile.txt"') do (
  SET string=%%A
  SET modified=!string:%target%=%replace%!
  
  echo !modified! &gt;&gt; %OUTFILE%
  )
  </code></pre>