I have create a batch file and write code as per picture. But my problem is it is always asked my pgpassword though i have already define it first. I need a solution early. TIA.
set PGPASSWORD=123456 
pg_dump -U postgres -W -F c YBD_ERP_Latest > E:\DBBackup\db_backup_%date:~-4%_%date:~3,2%_%date:~0,2%__%time:~0,2%_%time:~3,2%_%time:~6,2%.backup

The doc says:
-W
--passwordForce psql to prompt for a password before connecting to a database [...].
So even though you have defined the password in PGPASSWORD, you have also forced psql to prompt for a password.
--> just remove the -W flag from pgdump options
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With