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.
views:
77answers:
1
+4
A:
Reffering to you comment to Johannes' answer, you would need to modify your call to pg_dump
to something like this:
echo %3|pg_dump -h %1 -U %2 %4 > %5
The 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:
...
set PGPASSWORD=%3
pg_dump -h %1 -U %2 %4 > %5
...
Frank Bollack
2010-05-20 07:43:47
Thanks this suffices my immediate requirement
Krishna Kumar
2010-05-20 08:05:09
+1 and hooray for weird behavior :/
Joey
2010-05-20 08:50:23