Created
January 19, 2015 22:45
-
-
Save adrianstevens/13698d6c7210b3855528 to your computer and use it in GitHub Desktop.
WPF execute command line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Diagnostics; | |
using System.IO; | |
class Program | |
{ | |
static void Main() | |
{ | |
ProcessStartInfo start = new ProcessStartInfo(); | |
start.FileName = @"C:\someapp.exe"; // full path | |
start.UseShellExecute = false; | |
start.RedirectStandardOutput = true; | |
using (Process process = Process.Start(start)) | |
{ | |
// Read in all the text from the process using StreamReader | |
using (StreamReader reader = process.StandardOutput) | |
{ | |
string result = reader.ReadToEnd(); | |
Console.Write(result); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment