title: No Password Supplied / Positional Parameter not found PostgreSQL - Powershell
body: <p>I am trying to build a simple script that outputs a query to a csv in powershell. However, it keeps returning the following error: </p>
  
  <p>psql: fe_sendauth: no password supplied</p>
  
  <p>I tried exposing the password as this will be a safe environment, but have seen suggestions to use pgpass but no real explanation on how to implement.</p>
  
  <pre><code>Set-Location 'E:\Program Files\PostgreSQL\9.1\bin\';
  SET 'PGPASSWORD = myPwd';
  .\psql -U postgres -w MyDatabase 
  copy {'SELECT * FROM table';} TO 'C:\Users\e\Desktop\test1.csv' CSV DELIMITER ',';
  </code></pre>