Skip to content

Instantly share code, notes, and snippets.

@jskeet
Created September 21, 2016 21:33
Show Gist options
  • Save jskeet/016d9eaa9dcd485fd2b9f1df41c68800 to your computer and use it in GitHub Desktop.
Save jskeet/016d9eaa9dcd485fd2b9f1df41c68800 to your computer and use it in GitHub Desktop.
using System;
using System.Diagnostics;
using System.Windows.Forms;
namespace ConsoleExRun
{
class Program
{
[STAThread]
static void Main(string[] args)
{
var button = new Button { Text = "Click" };
var form = new Form
{
Controls = { button }
};
button.Click += delegate {
Process proc = new Process();
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.FileName = "ConsolePrinter.exe";
proc.StartInfo.RedirectStandardError = true;
proc.StartInfo.RedirectStandardInput = true;
proc.Start();
};
Application.Run(form);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment