I am using batch file to run certain operation in my application. The command I am using does not take password as a parameter instead it prompts for it while running. This is coming in the way of automating this script. I would like to know how I can take password as a parameter and provide to the application when it prompts.
Share
Reffering to you comment to Johannes’ answer, you would need to modify your call to
pg_dumpto something like this:echo %3|pg_dump -h %1 -U %2 %4 > %5The Problem is that pg_dump doesn’t allow you to pass in the password via stdin. That means this solution will not work here.
But as you can read in the docs here and here, there is the (unsecure) way of providing the password via environment variable
PGPASSWORD.So simply modify your batch file like this: