title: How to escape PowerShell double quotes from a .bat file
body: <p>I'm trying to replace all double quotes in a file (temp1.txt) with two double quotes using this PowerShell command, run from a bat file in Windows 7:</p>
  <pre><code>powershell -Command &quot;(gc c:\temp\temp1.txt) -replace '\&quot;', '\&quot;\&quot;' | Out-File -encoding UTF8 c:\temp\temp2.txt&quot;
  </code></pre>
  <p>I keep getting the error:</p>
  <blockquote>
  <p>'Out-File' is not recognized as an internal or external command.</p>
  </blockquote>
  <p>When I change the command to replace the letter &quot;a&quot; with the letter &quot;b&quot;, it works fine like this:</p>
  <pre><code>powershell -Command &quot;(gc c:\temp\temp1.txt) -replace 'a', 'b' | Out-File -encoding UTF8 c:\temp\temp2.txt&quot;
  </code></pre>
  <p>I need to escape the double quote since the entire <code>powershell -Command</code> is within a double quoted string. How do you escape the double quote?</p>