i need to run console applications from another c# application,how to load & pass arguments to console application from my c# application in order to execute the console
We can pass arguments to a console application in two ways. here with i have written a program showing both the methodologies. i think it will be very usefull
using System;
using System.Diagnostics;
using System.ComponentModel;
namespace ProcessSample
{
class ClsProcess
{
void OpenProcessWithArguments()
{
Process.Start("IExplore.exe", "www.google.com");
}
void OpenProcessWithStartInfo()
{
ProcessStartInfo startInfo = new ProcessStartInfo("IExplore.exe");
startInfo.WindowStyle = ProcessWindowStyle.Minimized;
Process.Start(startInfo);
startInfo.Arguments = "www.google.com";
Process.Start(startInfo);
}
static void Main()
{
ClsProcess myProcess = new ClsProcess();
myProcess.OpenProcessWithArguments();
myProcess.OpenProcessWithStartInfo();
}
}
}