Mono下C#如何调用linux命令 Mono下C#如何调用linux命令,并将linux命令结果返回到TextBox文本框中例如,用一个按钮控制ls -l命令,将linux下执行后的结果返回到前台页面文本框中 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 自己找到了// using System.Diagnostics; //添加该引用Process p = new Process();p.StartInfo.FileName = "sh";p.StartInfo.UseShellExecute = false;p.StartInfo.RedirectStandardInput = true;p.StartInfo.RedirectStandardOutput = true;p.StartInfo.RedirectStandardError = true;p.StartInfo.CreateNoWindow = true;p.Start();p.StandardInput.WriteLine("ls -l");p.StandardInput.WriteLine("exit");string strResult = p.StandardOutput.ReadToEnd();TextBox1.Text = strResult;p.Close(); 如何根据字体大小调节textbox的高度 线程的挂起及重启问题 .net 怎么防止按钮重复提交 请教大家为什么我用TDES(3重DES加密算法)加密解密字符串后,该字符串少了一截? 用C#编写读取和添加xml数据 C# 数据问题 DataGrid中TextBox内容读取并更新的问题 如何判断判断输入的是中文还是英文 c++的结构如何用c#来声明? 读二进制文件的问题 不用new作为修饰符怎么也没问题。。 【急!!】将 Winform 控件保存图像问题!
// using System.Diagnostics; //添加该引用Process p = new Process();
p.StartInfo.FileName = "sh";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.Start();
p.StandardInput.WriteLine("ls -l");
p.StandardInput.WriteLine("exit");
string strResult = p.StandardOutput.ReadToEnd();
TextBox1.Text = strResult;
p.Close();