redirecting output to the text file c#

前端 未结 2 1200
暖寄归人
暖寄归人 2020-11-29 07:24

This is my code:

Process pr2 = new Process();
pr2.StartInfo.FileName = \"show-snps\";
pr2.StartInfo.Arguments = @\"-Clr -x 2 out.delta > out.snps\";
pr2.S         


        
2条回答
  •  爱一瞬间的悲伤
    2020-11-29 08:23

    It didn't work because > redirect was supported by cmd.exe shell. Try the following code instead.

    Process pr2 = new Process();
    pr2.StartInfo.FileName = @"c:\windows\system32\cmd.exe";
    pr2.StartInfo.Arguments = @"/k \"show-snps -Clr -x 2 out.delta > out.snps\"";
    pr2.Start();
    pr2.WaitForExit();
    

提交回复
热议问题