0

Hi and thanks in advance. I am currently exporting from my postgres database VIA the psql shell with::

    \COPY "Accounts" TO 'C:\Users\admin\Desktop\Accounts.csv' CSV HEADER;

This works fine, but I want to be able to double click a batch file .cmd or .bat that is saved on my desktop to 1) log into the database 2) export the CSV. So that way I dont have to go into psql shell every time. Please help, I did google but postgres resources are few.

4
  • 2
    And what keeps you from doing that? Commented May 4, 2016 at 21:56
  • When posting here, you will generally get a warm and helpful response so long as you have tried to create the solution first and then post showing where you got stumped. Try updating your post once you have done this. Commented May 4, 2016 at 23:23
  • @a_horse_with_no_name I am on a Windows machine with Postgres installed. I do not know the syntax/how to do this. I am new to coding. I want to connect to the database then run that SQL command, just by double clicking one file. i'm assuming its a batch file but I do not know enough. Any help is appreciated. thank you. Commented May 4, 2016 at 23:24
  • Ahhh, windows...batch. You tagged this with the tag BASH. That is a scripting language for linux, mac and in rare cases windows. If using Windows you probably want a powershell script. Commented May 4, 2016 at 23:29

1 Answer 1

0

Because the comments above are limited in their length and formatting, I am sharing some basic research that might get you started:

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.