title: Batch File:: Write Special characters to text file
body: <p>I'm trying to print special characters to a text file.</p>
  
  <p>Those are my problematic lines :</p>
  
  <pre><code>(
  echo FOR /L %%A IN (1,1,3) DO (
  echo echo "%~f0" myText
  echo )
  ) &gt; myFile.bat
  </code></pre>
  
  <p>I tried to escape the special characters with <code>^</code> and with <code>\</code> but seems like it's not working properly</p>
  
  <p>I tried :</p>
  
  <p>1.</p>
  
  <pre><code>(echo FOR \/L \%\%A IN (1,1,3) DO \() &gt;&gt; myFile.bat
  </code></pre>
  
  <p>2.</p>
  
  <pre><code>(echo FOR ^/L ^%^%A IN (1,1,3) DO ^() &gt;&gt; myFile.bat
  </code></pre>
  
  <p>3.</p>
  
  <pre><code>(echo echo \"%~f0\" myText) &gt;&gt; myFile.bat
  </code></pre>
  
  <p>4.</p>
  
  <pre><code>(echo echo ^"%~f0\^" myText) &gt;&gt; myFile.bat
  </code></pre>
  
  <p>None of them is working properly.
  I was wondering if there is a command like in php</p>
  
  <pre><code>$myText = &lt;&lt;&lt;EOF
  
  EOF;
  </code></pre>
  
  <p>That would magically do the task but if not ... </p>