PowerShell脚本可以从Postgres表中读取数据
我正在创建一个PowerShell脚本来读取Postgres DB
的数据 但是psql.exe
命令在 psql.exe
行之后,控制台要求密码
而且只有只有当我按ctrl+c
执行其他行时,
我尝试使用start-job,但是我无法读取我的选择命令的输出,仅返回以下行Job启动:System.Management.Automation.promotingjob
指出工作已经开始,
我也尝试了Invoke-command,但这也无济于事。
任何人都可以帮助我使用一个简单的示例,该示例说明如何输入psql.exe CMD的密码以及如何从选择CMD读取输出
I am creating a powershell script to read data from a postgres DB
But any lines given after the psql.exe
command does not works
after the psql.exe
line the console asks for the password
and does nothing it's only when I press Ctrl+C
the other lines get executed
I tried using Start-Job but then I am unable to read the output of my select command it only returns the following lineJob started: System.Management.Automation.PSRemotingJob
stating that the job has started
I also tried the Invoke-Command but that too didn't help.
Can anyone help me with a simple sample that explains how to enter password for the psql.exe cmd and how to read the output from the select cmd
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我正在分享对我有用的方法
,现在您可以从结果变量中访问Select的输出。
您可以将方法用于方法并迭代结果以读取每一行。
I am sharing the approach that worked for me
Now you can access the output of the select from the result variable.
You can use a for method and iterate over result to read each row.