现在我有一个C#写的界面程序,我希望在这个程序中调用一个另外
一个命令行程序,并且获取这个命令行程序的输出,然后显示在C#
界面程序的TextBox里,我应该如何做呢?
如果要调用的是java的.jar程序,是不是实现方式又有不同?请大虾
们指教!
---------------------------------------------------------------
System.Diagnostics.ProcessStartInfo ps = new ProcessStartInfo( "Ping.exe" , "127.0.0.1" );
ps.UseShellExecute = false;
ps.CreateNoWindow = true;//加这一句
ps.RedirectStandardOutput = true;
Process p= Process.Start(ps);
p.WaitForExit();
string output = p.StandardOutput.ReadToEnd();
this.textBox1.Text = output;
一个C#中调用命令行程序的问题
最新推荐文章于 2024-02-13 08:03:10 发布
1432

被折叠的 条评论
为什么被折叠?



