C# 中的 Powershell Sqlcmd 弹出窗口
我有一个执行 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
例如:
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.
为什么不直接调用安装 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?