复制代码 代码如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
namespace TestEqual
{
class Program
{
static void Main(string[] args)
{
Process myProcess = new Process();
myProcess.StartInfo.FileName = "iexplore.exe";
myProcess.StartInfo.Arguments = "http://www.baidu.com";
myProcess.Start();
}
}
}
复制代码 代码如下:
string hostname = "http://www.baidu.com"; //或者这里是ip等;
Process prc=new Process();
prc.StartInfo.FileName="cmd.exe";
prc.StartInfo.UseShellExecute=false;
prc.StartInfo.RedirectStandardInput = true;
prc.StartInfo.RedirectStandardOutput = true;
prc.StartInfo.RedirectStandardError = true;
prc.StartInfo.CreateNoWindow = false;
prc.Start();
prc.StandardInput.WriteLine("ping " + hostname);
prc.StandardInput.Close();
Response.Write(prc.StandardOutput.ReadToEnd());
新闻热点
疑难解答
图片精选