【发布时间】:2015-06-23 10:54:38
【问题描述】:
我一直在绞尽脑汁想弄清楚为什么我不能使用 >>(附加)作为我的 p.StartInfo.Argument 的一部分。当我删除“>”时,它工作得很好,但是当我尝试使用“>”或“>>”时,我得到一个“不正确的参数”错误。我已经开始编写没有 > 或 >> 的程序,只是将输出存储到一个字符串中,然后再将其写入文件。有人可以解释为什么“>”或“>>”在这种情况下不起作用吗?
// Start the child process.
Process p = new Process();
// Redirect the output stream of the child process.
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = "attrib.exe";
startInfo.Arguments = "/S *.jpg > mypics.txt";
p.Start();
【问题讨论】:
标签: c# append command-line-arguments