我有一个 app.exe 应用程序要求输入输入路径字符串,一旦我输入,它就会要求输出路径字符串......现在当我输入时,app.exe 执行一些操作
我需要从我的窗口窗体应用程序中传递这些路径我看到了很多这样的问题,但无法实现我所需要的,因为我从未使用过流程和 Stream Reader 或 Writer 请提供任何帮助......示例将不胜感激......谢谢你..
string input = @"C:\Documents and Settings\pankaj\Desktop\My File\greetingsfreinds.ppt";
string output = @"C:\Documents and Settings\pankaj\Desktop\test";
Process process = new Process();
process.StartInfo.FileName = @"C:\Program Files\Wondershare\MyApp\app.exe";
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = false;
process.StartInfo.RedirectStandardInput = true;
process.Start();
process.WaitForExit(3000);
process.Close();
好的,我试过了,但是它给出了一些异常 StandardOut 没有被重定向或者进程还没有开始......我的代码是
string input = @"C:\Documents and Settings\pankaj\Desktop\My File\greetingsfreinds.ppt";
string output = @"C:\Documents and Settings\pankaj\Desktop\test";
Process process = new Process();
process.StartInfo.FileName = @"C:\Program Files\Wondershare\MyApp\app.exe";
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = false;
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.Arguments = input + ";" + output;
process.Start();
string Strout = process.StandardOutput.ReadToEnd();
process.WaitForExit();
process.Close();