Ashok
Try the following code
Process mDOSProcess= new Process();
mDOSProcess.StartInfo.FileName = @"cmd.exe";
mDOSProcess.StartInfo.Arguments = your arguments;
//if you dont want to see the dos black screen
mDOSProcess.StartInfo.CreateNoWindow = true;
mDOSProcess.StartInfo.UseShellExecute = false;
//if you want to make use of the output throw
mDOSProcess.StartInfo.RedirectStandardOutput = true;
mDOSProcess.EnableRaisingEvents = true;
mDOSProcess.Exited += new EventHandler(Process_exited);
//now start the process
mDOSProcess.Start();
//if you wanna wait for some reason to get completed for post processing
mpDOSProcess.WaitForExit();
Shak.
"Ashok Subramanian" <as******@hotmail.com> wrote in message
news:46*************************@posting.google.co m...
Hello,
I am calling Process.Start from a C# code in the following way..where
startInfo is the object containing the process information.
try
{
Process installProc = null;
installProc = Process.Start(startInfo);
}
catch(Exception ex)
{
throw ex;
}
If for some reason I pass invalid arguments to the process I am
starting, I get a message saying "The application could not be
initialised". I never go to the catch block. Is there a way I can
catch this exception? Even if I pass wrong arguments, I need to catch
the exception to log it gracefully.
Thanks for the help,
Ashok