ProcessStartInfo.UseShellExecute : ProcessStartInfo « System.Diagnostics « C# / C Sharp by API






ProcessStartInfo.UseShellExecute

  


using System;
using System.Diagnostics;

public class RedirectingProcessOutput
{
    public static void Main()
    {
        Process p = new Process();
        p.StartInfo.FileName = "cmd.exe";
        p.StartInfo.Arguments = "/c dir *.cs";
        p.StartInfo.UseShellExecute = false;
        p.StartInfo.RedirectStandardOutput = true;
        p.Start();
        
        string output = p.StandardOutput.ReadToEnd();
        
        Console.WriteLine("Output:");
        Console.WriteLine(output);    
    }
}

   
    
  








Related examples in the same category

1.new ProcessStartInfo()
2.ProcessStartInfo.Arguments
3.ProcessStartInfo.ErrorDialog
4.ProcessStartInfo.FileName
5.ProcessStartInfo.RedirectStandardOutput
6.ProcessStartInfo.WindowStyle
7.ProcessStartInfo.WorkingDirectory