2007-06-30 09:00
2007-06-30 11:19
using System;
using System.Diagnostics;
namespace cmd
{
/// <summary>
/// Class1 的摘要说明。
/// </summary>
class Class1
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main(string[] args)
{
//
// TODO: 在此处添加代码以启动应用程序
//
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.Start ();
p.StandardInput.WriteLine("ping -n 1 192.168.1.40");
p.StandardInput.WriteLine("exit");
string strRst = p.StandardOutput.ReadToEnd();
}
}
}
我尝试一下,但只弹出一个窗口后什么也没有了,而我有Ping查看又能看到结果,请高手指教!

2007-06-30 15:38
2007-07-02 15:42
using System;
using System.Diagnostics;
namespace cmd
{
/// <summary>
/// Class1 的摘要说明。
/// </summary>
class Class1
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main(string[] args)
{
//
// TODO: 在此处添加代码以启动应用程序
//
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.Start ();
p.StandardInput.WriteLine("ping -n 1 192.168.1.40");
p.StandardInput.WriteLine("exit");
string strRst = p.StandardOutput.ReadToEnd();
}
}
}
我尝试一下,但只弹出一个窗口后什么也没有了,而我有Ping查看又能看到结果,请高手指教!

2007-07-03 08:42
2007-07-03 16:15
2007-07-03 16:17