private void btnTest_Click(object sender, EventArgs e) { // Application path and command line arguments string ApplicationPath = "edit d:\\sk.txt"; string ApplicationArguments = " -a"; System.Diagnostics.Process ProcessObj; ProcessObj = new System.Diagnostics.Process(); // StartInfo contains the startup information of the new process ProcessObj.StartInfo.FileName = ApplicationPath; ProcessObj.StartInfo.Arguments = ApplicationArguments; // These two optional flags ensure that no DOS window appears ProcessObj.StartInfo.UseShellExecute = false; ProcessObj.StartInfo.CreateNoWindow = true; //' If this option is set the DOS window appears again :-/ //ProcessObj.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; //' This ensures that you get the output from the DOS application ProcessObj.StartInfo.RedirectStandardOutput = true; //' Start the process ProcessObj.Start(); //' Wait that the process exits ProcessObj.WaitForExit(); //' Now read the output of the DOS application System.Windows.Forms.MessageBox.Show(ProcessObj.StandardOutput.ReadToEnd()); }
ProcessObj.StartInfo.FileName = "Notepad"; ProcessObj.StartInfo.Arguments = "c:\\MPUsbSIn.txt"
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)