1) The pgpass.conf
(of PostgreSQL) is:
localhost:5432:*:postgres:mypassword
I have no experience with batch and I have spent the day searching in the net.
I'm using Windows – if that matters.
2) I tried with a file.bat as:
cd C:
start "" "C:\Program Files\PostgreSQL\9.4\bin\psql.exe" "C:\Users\utente\Desktop\1Giswater impNode.sql"
pause
start "" "C:\Program Files\PostgreSQL\9.4\bin\psql.exe" "C:\Users\utente\Desktop\2Giswater impArc.sql"
pause
start "" "C:\Program Files\PostgreSQL\9.4\bin\psql.exe" "C:\Users\utente\Desktop\3assegnazione enet.sql"
pause
After typing my password the result is:
3) I've written a simple file.bat
, which is:
cd C:\Program Files\PostgreSQL\9.4\bin\
pause
rem psql --help
pause
psql -e -a -f="C:\Users\utente\Desktop\1Giswater impNode.sql" -d=postgres -U=postgres
The result is:
What am I missing?
Best Answer
You are passing the username incorrectly:
The "short" parameter names don't use the
=
sign:So it should either be:
or, when using the long parameter names: