I use the following batch file to create a new database in PostgreSQL 10.
echo off
cd "C:\Program Files (x86)\PostgreSQL\10\bin"
createdb -h localhost -p 5432 -U postgres myDB
But it asks to enter the password. How to prevent asking for the password? I tried the -w
option explained in this link to not ask for password prompt. But this did not work. How to prevent asking for password?
Best Answer
use the
PGPASSWORD
environment variable,or just use a connection string