简体   繁体   English

Process.Start从错误输出到C#中的日志

[英]Process.Start with error output into log in C#

Below is my command i execute over command line in Windows. 以下是我在Windows中通过命令行执行的命令。

C:\>"C:\application.exe" "C:\filename.txt" 2>> "C:\errorlog.log"

This command below works without log file, but i would like to add the output into log file. 以下命令在没有日志文件的情况下有效,但是我想将输出添加到日志文件中。

System.Diagnostics.Process.Start(@"""C:\application.exe"", @"""C:\filename.txt""");

I would like to do the same in C#, but it doesn't work for me, this is my code i have now: 我想在C#中做同样的事情,但是对我来说不起作用,这是我现在拥有的代码:

System.Diagnostics.Process.Start(@"""C:\application.exe"", @"""C:\filename.txt"" 2>> ""C:\errorlog.log""");

Thank you 谢谢

send parameters as string : 将参数作为字符串发送:

try this: 尝试这个:

System.Diagnostics.Process.Start(@"C:\application.exe" , @"C:\filename.txt 2>> C:\errorlog.log");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM