开发者

multiple command execution

I have created a installer with innosetup and i wanna use it to create a postgresql database using psql.exe . I call the psql.exe with this line of code :

Filename: "{app}\PostgreSQL\bin\psql.exe"; Parameters: "-W postgres";

The problem is that psql ask for user password and there is no option to pass it in one call .

Is it possible to simulat开发者_StackOverflowe the "Enter" key and add the password just after ? If there is another solution let me know please.

Thanks .


There is the PGPASSWORD environment variable:

PGPASSWORD behaves the same as the password connection parameter. Use of this environment variable is not recommended for security reasons, as some operating systems allow non-root users to see process environment variables via ps; instead consider using the ~/.pgpass file.

As mentioned, there is also the password file but the environment variable would probably be fine for an installer. In either case you'd drop the -W switch.

You could also build a special purpose tool to talk to PostgreSQL directly rather than go through psql.exe.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜