求ping命令脚本 求ping命令脚本,能在前台显示时间,数据包个数、大小。并能自动生成一个txt文档(用来记录这些显示数据). 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 web?winform?System.Net.NetworkInformation.Ping或cmd输出重定向 ping 127.0.0.1 2>&1 |tee log.txt 使用时直接调用该方法即可 //ping private void pingIP(string testip) { Process p = new Process(); p.StartInfo.FileName = "cmd.exe"; p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardInput = true; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardError = true; p.StartInfo.CreateNoWindow = true; p.Start(); //-n 后面的2表示ping的次数 p.StandardInput.WriteLine("ping -n 2 " + testip); p.StandardInput.WriteLine("exit"); string stre = p.StandardOutput.ReadToEnd(); p.Close(); //stre是ping返回的信息 MessageBox.Show(stre.ToString()); } 怎样快速数据导入Xls到SQL中? C#中webbrowser控件的使用 上百万文件替换工具哪个好? 为什么不进if语句!????? 在部署安装完后怎样自动还原数据库的代码 急!回复就有分! 动态更新数据 如何能够让TextBox默认显示为一行,根据输入内容的变化,TextBox高度能够自动增加? 请教一个C#的语法问题 疑惑,URL重新怎么防止别人盗链文件呢? 各位大虾,请帮我看一下这些代码哪里有错,谢谢。 为什么visual studio 2008经常莫名其妙地报错?求教高手 c# 如何将ppt中的每一页保存为一张张的图片?
System.Net.NetworkInformation.Ping
或cmd输出重定向
//ping
private void pingIP(string testip)
{
Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.Start();
//-n 后面的2表示ping的次数
p.StandardInput.WriteLine("ping -n 2 " + testip);
p.StandardInput.WriteLine("exit");
string stre = p.StandardOutput.ReadToEnd();
p.Close();
//stre是ping返回的信息
MessageBox.Show(stre.ToString());
}