开发者

Different behavior with running psexec from WPF app when executing from command line vs. double-click

开发者 https://www.devze.com 2023-03-12 18:52 出处:网络
I am using process.Start to execute psexec which executes an msi remotely. For some reason, process.StandardOutput.ReadToEnd() hangs when I double-clicked on the a开发者_如何学Gopplication, but when

I am using process.Start to execute psexec which executes an msi remotely.

For some reason, process.StandardOutput.ReadToEnd() hangs when I double-clicked on the a开发者_如何学Gopplication, but when I execute the WPF app from a command prompt it is fine.

Anybody have any ideas?

Thanks.


I believe you are blocking on the synchronous ReadToEnd call. You might want to use Process.BeginOutputReadLine instead because it's asynchronous: http://msdn.microsoft.com/en-us/library/system.diagnostics.process.beginoutputreadline.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消