Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Diagnostics;
- Process p = new Process();
- p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
- p.StartInfo.FileName = processname;
- p.StartInfo.Arguments = arguments;
- p.Start();
- p.WaitForExit()
- public static void execute(string processname, string arguments) {
- Process p = new Process();
- p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
- p.StartInfo.FileName = processname;
- p.StartInfo.Arguments = arguments;
- p.StartInfo.UseShellExecute = false;
- p.StartInfo.RedirectStandardOutput = true;
- p.StartInfo.RedirectStandardError = true;
- p.Start();
- p.WaitForExit();
- var stdout = p.StandardOutput.ReadToEnd();
- var stderr = p.StandardError.ReadToEnd();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement