Ashok
Try the following code
Process mDOSProcess= new Process();
mDOSProcess.Sta rtInfo.FileName = @"cmd.exe";
mDOSProcess.Sta rtInfo.Argument s = your arguments;
//if you dont want to see the dos black screen
mDOSProcess.Sta rtInfo.CreateNo Window = true;
mDOSProcess.Sta rtInfo.UseShell Execute = false;
//if you want to make use of the output throw
mDOSProcess.Sta rtInfo.Redirect StandardOutput = true;
mDOSProcess.Ena bleRaisingEvent s = true;
mDOSProcess.Exi ted += new EventHandler(Pr ocess_exited);
//now start the process
mDOSProcess.Sta rt();
//if you wanna wait for some reason to get completed for post processing
mpDOSProcess.Wa itForExit();
Shak.
"Ashok Subramanian" <as******@hotma il.com> wrote in message
news:46******** *************** **@posting.goog le.com...
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(s tartInfo);
}
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