多命令执行
我已经使用 innosetup 创建了一个安装程序,我想用它来使用 psql.exe 创建一个 postgresql 数据库。 我用这行代码调用 psql.exe:
Filename: "{app}\PostgreSQL\bin\psql.exe";参数:“-W postgres”;
问题是 psql 要求输入用户密码,并且没有选项可以在一次调用中传递它。
是否可以模拟“Enter”键并在后面添加密码? 如果有其他解决方案,请告诉我。
谢谢 。
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 simulate the "Enter" key and add the password just after ?
If there is another solution let me know please.
Thanks .
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有
PGPASSWORD
环境变量 :如前所述,还有 密码文件 但环境变量对于安装人员来说可能没问题。无论哪种情况,您都需要删除
-W
开关。您还可以构建一个专用工具来直接与 PostgreSQL 对话,而不是通过
psql.exe
。There is the
PGPASSWORD
environment variable: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
.