protected void Button1_Click(object sender, EventArgs e)

        {

            string executePath = System.Configuration.ConfigurationSettings.AppSettings["executePath"];

            ExecuteCommandSync(executePath);

 

            string resultfilePath = System.Configuration.ConfigurationSettings.AppSettings["filePath"];

 

            this.Label1.Text = System.IO.File.ReadAllText(resultfilePath);

 

        }

        public void ExecuteCommandSync(string executePath)

        {

            try

            {

                System.Diagnostics.Process p = new System.Diagnostics.Process(); // Redirect the output stream of the child process.

                p.StartInfo.UseShellExecute = false;

                p.StartInfo.RedirectStandardOutput = true;

                p.StartInfo.FileName = executePath;

                p.Start(); // Do not wait for the child process to exit before // reading to the end of its redirected stream. // p.WaitForExit(); // Read the output stream first and then wait. string output = p.StandardOutput.ReadToEnd(); p.WaitForExit();

                p.WaitForExit();

            }

            catch (Exception ex)

            {

                System.Diagnostics.Debug.WriteLine(ex.ToString());

            }

 

        }