Starting a shell process : Shell Process : Windows C# Examples


C# Examples » Windows » Shell Process »

 

Starting a shell process









    
using  System;
using  System.Collections.Generic;
using  System.Diagnostics;
using  System.IO;
using  System.Reflection;
using  System.Runtime;
using  System.Runtime.CompilerServices;
using  System.Security;
using  System.Text;
using  System.Threading;

public  class  MainClass
{
        public  static  void  Main()
        {
                ProcessStartInfo  pi  =  new  ProcessStartInfo("dir.exe");
                pi.UseShellExecute  =  false;
                pi.RedirectStandardOutput  =  true;
                pi.Arguments  =  "C:\\";

                Process  p  =  Process.Start(pi);
                StreamReader  sr  =  p.StandardOutput;

                String  line;
                while  ((line  =  sr.ReadLine())  !=  null)
                {
                        Console.WriteLine("Read  line:  {0}",  line);
                }
                p.WaitForExit();
        }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Windows
» Shell Process