wProc.cs
using System; using System.Linq; using System.Text; using System.Diagnostics; using System.Collections.Generic; public class WProc { public WProc() { } public string run(string fileName) { System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.StartInfo.FileName = fileName; //@"C:\Users\Vitor\ConsoleApplication1.exe"; proc.StartInfo.Arguments = "olaa"; //argument proc.StartInfo.UseShellExecute = false; proc.StartInfo.RedirectStandardOutput = true; proc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; proc.StartInfo.CreateNoWindow = true; //not diplay a windows proc.Start(); string output = proc.StandardOutput.ReadToEnd(); //The output result proc.WaitForExit(); return output; } public void execute(string fileName) { Process proc = new Process(); proc.StartInfo.FileName = fileName; //"Notepad.exe"; //proc.StartInfo.WindowStyle = ProcessWindowStyle.Maximized; proc.Start(); proc.WaitForExit(); //System.Diagnostics.Process.Start("calc.exe"); } }
댓글 없음:
댓글 쓰기