Friday, 22 August 2014

run exe with parameter from asp.net c#

run exe with parameter from asp.net c#  :

run exe with parameter from asp.net c# 

aspx:cs

public void RunEXE()
        {
            System.Diagnostics.Process process1 = new System.Diagnostics.Process();

            process1.StartInfo.UseShellExecute = true;
//Exe Name
            process1.StartInfo.FileName = @"Sample.exe";
//Path Name
            process1.StartInfo.WorkingDirectory = @"E:\vijay\Sample\Bin\";
//Parameter Name
            process1.StartInfo.Arguments = @"E:\vijay\Sample\Bin\"+ "Test.txt";
            process1.Start();

            process1.WaitForExit();

            Thread.Sleep(20000);//Assume within 20 seconds it will finish processing. 
            process1.Close();
        }

No comments:

Post a Comment