如何在没有Process.start(…)的情况下在浏览器中打开网站URL:
System.Diagnostics.Process.Start(@"http://www.google.com");
我无法在Windows服务中使用Process.Start(),我不知道为什么.
解决方法
请参阅问题“
How can a Windows service execute a GUI application?”的答案:
use WTSEnumerateSessions to find the right desktop,then CreateProcessAsUser to start the application on that desktop
还要注意你不应该这样做:)
cmd.exe /c start http://example.com/
如果要禁止短暂显示的命令提示符窗口,可以将STARTUPINFO
structure的wShowWindow字段设置为SW_HIDE,或者在.NET中将ProcessStartInfo.WindowStyle
属性设置为ProcessWindowStyle.Hidden.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。