title: Using MySQL in Powershell, how do I pipe the results of my script into a csv file?
body: <p>In PowerShell, how do I execute my mysql script so that the results are piped into a csv file? The results of this script is just a small set of columns that I would like copied into a csv file.</p>
  
  <p>I can have it go directly to the shell by doing:</p>
  
  <pre><code>mysql&gt; source myscript.sql
  </code></pre>
  
  <p>And I have tried various little things like:</p>
  
  <pre><code>mysql&gt; source myscript.sql &gt; mysql.out
  mysql&gt; source myscript.sql &gt; mysql.csv
  </code></pre>
  
  <p>in infinite variation, and I just get errors. My db connections is alright because I can do basic table queries from the command line etc... I haven't been able to find a solution on the web so far either...</p>
  
  <p>Any help would be really appreciated!</p>