title: How to execute postgres' sql queries from batch file?
body: <p>I need to execute SQL from batch file.
  I am executing following to connect to Postgres and select data from table </p>
  
  <pre><code>C:/pgsql/bin/psql -h %DB_HOST% -p 5432 -U %DB_USER% -d %DB_NAME% 
  select * from test;
  </code></pre>
  
  <p>I am able to connect to database, however I'm getting the error</p>
  
  <blockquote>
    <p>'select' is not recognized as an internal or external command,
    operable program or batch file.</p>
  </blockquote>
  
  <p>Has anyone faced such issue?</p>
  
  <p>This is one of the query i am trying, something similar works in shell script, (please ignore syntax error in the query if there are any)</p>
  
  <pre><code>copy testdata (col1,col2,col3) from '%filepath%/%csv_file%' with csv;
  </code></pre>