System.Diagnostics.Process.WaitForExit C# (CSharp) Method

WaitForExit() public method

public WaitForExit ( int milliseconds ) : bool
milliseconds int
return bool
        public bool WaitForExit(int milliseconds) { throw null; }
    }

Same methods

Process::WaitForExit ( ) : void

Usage Example

Esempio n. 1
12
        public String cmd(String cnd)
        {

            cnd = cnd.Trim();
            String output = " ";
            Console.WriteLine(cnd);

            if ((cnd.Substring(0, 3).ToLower() == "cd_") && (cnd.Length > 2))
            {

                if (System.IO.Directory.Exists(cnd.Substring(2).Trim()))
                    cpath = cnd.Substring(2).Trim();

            }
            else
            {
                cnd = cnd.Insert(0, "/B /c ");
                Process p = new Process();
                p.StartInfo.WorkingDirectory = cpath;
                p.StartInfo.CreateNoWindow = true;
                p.StartInfo.FileName = "cmd.exe";
                p.StartInfo.Arguments = cnd;
                p.StartInfo.UseShellExecute = false;
                p.StartInfo.RedirectStandardOutput = true;
                p.Start();
                output = p.StandardOutput.ReadToEnd();  // output of cmd
                output = (output.Length == 0) ? " " : output;
                p.WaitForExit();

            }
            return output;
        } // end cmd 
All Usage Examples Of System.Diagnostics.Process::WaitForExit