private void button1_Click(object sender, EventArgs e)
{
char[] buffer = new char[1024]; char[] buffer1 = new char[1024];
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();
string info;
p.StandardInput.WriteLine("D:");
p.StandardOutput.Read(buffer, 0, 1024);
p.StandardInput.WriteLine("xxxx");
p.StandardOutput.Read(buffer, 0, 1024);
p.StandardInput.WriteLine("xxxxx");
p.StandardOutput.Read(buffer, 0, 1024);
p.StandardInput.WriteLine("xxxxxxxxx"); p.StandardOutput.Read(buffer1,0,1024);
}最后一个命令本来是下载东西,然后有一个进度,为什么执行后得不到我要的结果。直接跳出,buffer1里面没我要的结果
{
char[] buffer = new char[1024]; char[] buffer1 = new char[1024];
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();
string info;
p.StandardInput.WriteLine("D:");
p.StandardOutput.Read(buffer, 0, 1024);
p.StandardInput.WriteLine("xxxx");
p.StandardOutput.Read(buffer, 0, 1024);
p.StandardInput.WriteLine("xxxxx");
p.StandardOutput.Read(buffer, 0, 1024);
p.StandardInput.WriteLine("xxxxxxxxx"); p.StandardOutput.Read(buffer1,0,1024);
}最后一个命令本来是下载东西,然后有一个进度,为什么执行后得不到我要的结果。直接跳出,buffer1里面没我要的结果
解决方案 »
- 「玩一玩」策略游戏《蜂窝大战 Hive Battle》抢旗模式复刻版
- 有几个实体的操作相似,并且实体结构也差不多,如何可以达到复用
- 关于水晶报表的直接打印
- DataGrid 选中全行问题
- 启动调试(F5)出现这个?!请指教啊
- 谁有C# TCP/IP文件传输的例子给一份吧?源代码也行啊!
- 朋友,我心中你永远是最棒的,进来看看吧!。。。。。。。。
- 请教:如何在UserControl中提供一个OnClosing事件
- 现有C#版主一名额
- 我出学习 C#现在碰到了一个 难题关于webform的问题 。
- ?????ASP.NET做的程序在studio里正常运行,放到IIS下就出错了,求解中
- C#能编程开启ClearType吗?我想在安装程序中开启ClearType……
c#调用cmd并获取返回信息