我有一个app.exe应用程序要求输入输入路径字符串,一旦输入,它就会请求输出路径字符串.现在,当我进入时,app.exe执行一些操作
我需要从我的窗口表单应用程序中传递这些路径--我看到了很多这样的问题,但是无法实现我所需要的,因为我从未使用过进程和流读取器或作家,请提供任何帮助。将感谢这些例子。谢谢。。
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();发布于 2013-01-09 10:20:45
为此您可以使用ProcessStartInfo.Arguments。
Process process = new Process()
process.StartInfo.FileName = @"C:\Program Files\Wondershare\MyApp\app.exe";
process.StartInfo.UseShellExecute = false;
....
process.Arguments = input + " " + output;https://stackoverflow.com/questions/14232960
复制相似问题