Run sql scripts using batch file

Viewed 35

I am trying to create a batch file that connects to my local Postgres 14 server and creates tables by opening a .sql file that contains all the table scripts.

For now, I was able to connect to the server using this code:

psql -U postgres -h localhost -d test

This command opens the command prompt and asks for the password. After this, how do I update the batch file to insert the password and automtically install the tables from my .sql file?

0 Answers
Related