In the Postgres command line, it always prompts a password if the password is not set. We can avoid this in the following way.
Before running any Postgres command-line command set the password
set PGPASSWORD=<your_passwprd>
example ->
set PGPASSWORD=admin
For Linux:
export PGPASSWORD=<your_passwprd>
example ->
exportPGPASSWORD=admin