C# 中的 Powershell Sqlcmd 弹出窗口

发布于 2024-07-15 10:53:49 字数 132 浏览 10 评论 0原文

我有一个执行 Powershell 脚本 myscript.ps1 的 PSHost 对象,并且该 .ps1 脚本正在执行 sqlcmd.exe 来完成它需要完成的任务。 有没有办法阻止它弹出空的 sqlcmd dos 提示(就像它看起来的那样)?

I have a PSHost object executing a Powershell script myscript.ps1 and that .ps1 script is executing sqlcmd.exe to get what it needs done. Is there a way to keep it from popping up empty sqlcmd dos prompts (as it seems to do)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

花辞树 2024-07-22 10:53:50

例如:
http://blog.sapien。 com/index.php/2006/12/26/more-fun-with-scheduled-powershell

您将不得不将 sqlcmd.exe 包装在其他东西中,因为 PowerShell 无法 AFAIK。

从脚本编写的角度来看,这对于 v2 中的 powershell.exe 确实有所改变,但我不确定在自定义主机的 SDK 中是否可用。

For example:
http://blog.sapien.com/index.php/2006/12/26/more-fun-with-scheduled-powershell

You're going to have to wrap sqlcmd.exe in something else as PowerShell isn't able to AFAIK.

From a scripting perspective, this does change for powershell.exe in v2, but I'm not sure that is available in SDK for custom hosts.

温柔嚣张 2024-07-22 10:53:50

为什么不直接调用安装 SSMS 时提供的 Invoke-SQLCmd cmdlet,而不是调用 sqlcmd.exe?

instead of calling sqlcmd.exe why not just call the Invoke-SQLCmd cmdlet that comes when you install SSMS?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文