示例#1
0
        void shellControl1_CommandEntered(object sender, UILibrary.CommandEnteredEventArgs e)
        {
            string command = e.Command;

            if (!ProcessInternalCommand(command))
            {
                ProcessStartInfo startInfo = new ProcessStartInfo("cmd.exe");
                startInfo.Arguments              = "/C " + e.Command;
                startInfo.RedirectStandardError  = true;
                startInfo.RedirectStandardOutput = true;
                startInfo.UseShellExecute        = false;
                startInfo.CreateNoWindow         = true;
                Process p      = Process.Start(startInfo);
                string  output = p.StandardOutput.ReadToEnd();
                string  error  = p.StandardError.ReadToEnd();

                p.WaitForExit();
                if (output.Length != 0)
                {
                    shellControl1.WriteText(output);
                }
                else if (error.Length != 0)
                {
                    shellControl1.WriteText(error);
                }
            }
        }
示例#2
0
 private void form_Console(object sender, ConsoleEventArgs e)
 {
     shellControl1.WriteText(e.line);
 }