Starting new process c#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alag20
    New Member
    • Apr 2007
    • 84

    Starting new process c#

    Hi,
    I need to start a new process from c#. I am currently doing it as below

    [HTML]
    ProcessStartInf o psi = new ProcessStartInf o(@"appname");
    psi.RedirectSta ndardOutput = true;
    psi.WindowStyle = ProcessWindowSt yle.Hidden;
    psi.UseShellExe cute = false;
    System.Diagnost ics.Process listFiles;
    psi.Arguments = "test";
    psi.WindowStyle = ProcessWindowSt yle.Hidden;
    listFiles = System.Diagnost ics.Process.Sta rt(psi);
    psi.WindowStyle = ProcessWindowSt yle.Hidden;
    StreamReader myOutput = listFiles.Stand ardOutput;
    while (!listFiles.Has Exited){
    listFiles.WaitF orExit(2000);
    }
    string output = myOutput.ReadTo End();
    [/HTML]


    The problem with this is when the above is started a dos window comes up with focus. I would ideally like no dos window to be displayed! Can someone please help me with this?
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    ProcessStartInf o has a propery called .CreateNoWindow
    Add this line:
    psi.CreateNoWin dow = true;

    See if that helps?

    Comment

    • alag20
      New Member
      • Apr 2007
      • 84

      #3
      Originally posted by Plater
      ProcessStartInf o has a propery called .CreateNoWindow
      Add this line:
      psi.CreateNoWin dow = true;

      See if that helps?
      Thanks - You are a star! It works amazingly [still working on the other issue]

      Comment

      Working...