/// <summary> /// Runs a process. /// </summary> /// <param name="fileName">Name of the file.</param> /// <param name="arguments">The arguments.</param> public void StartProcess(string fileName, string arguments) { // Are we showing diagnostics? if (ShowDiagnostics) { WriteOutput("Preparing to run " + fileName, Color.FromArgb(255, 0, 255, 0)); if (!string.IsNullOrEmpty(arguments)) { WriteOutput(" with arguments " + arguments + "." + Environment.NewLine, Color.FromArgb(255, 0, 255, 0)); } else { WriteOutput("." + Environment.NewLine, Color.FromArgb(255, 0, 255, 0)); } } // Start the process. _processInteface.StartProcess(fileName, arguments); // If we enable input, make the control not read only. if (IsInputEnabled) { InternalRichTextBox.ReadOnly = false; } }
private void Window_Loaded(object sender, RoutedEventArgs e) { _loaded = true; _cmd = new ProcessInterface(); _cmd.OnProcessOutput += cmd_OnProcessOutput; _cmd.OnProcessError += cmd_OnProcessOutput; _cmd.OnProcessExit += cmd_OnProcessExit; _cmd.StartProcess("cmd.exe", "/q /k shellloader.cmd"); }
private void Button1_OnClick(object sender, RoutedEventArgs e) { processInterace.StartProcess("cmd", ""); }