[Mono-winforms-list] Run One Exe from another exe
David Lancia, Jr.
dlancia@bu.edu
Thu, 27 Jan 2005 09:53:07 -0500
In Reply To:
> Hi
> I am running one simple Program that call another exe
>
> Code :
>
> System.Diagnostics.Process proc = new System.Diagnostics.Process();
> proc.EnableRaisingEvents=false;
> proc.StartInfo.FileName="WindowTest";
> proc.StartInfo.Arguments="WindowTest.exe";
> proc.Start(); proc.WaitForExit();
>
> This is call when i press the button.
> The WindowTest.exe is present in bin folder of the application, When i
> Press the button , it call that Speficied file/path is not present
>From my previous experience using the Process class, it looks like you have
a couple things confused. I may be misunderstanding what you want to do but
I believe your code should look more like this:
System.Diagnostics.Process proc = new System.Diagnostics.Process();
//Uncomment next line to set the directory to launch the program from
//proc.StartInfo.WorkingDirectory = myWorkingDir;
proc.EnableRaisingEvents=false;
proc.StartInfo.FileName="WindowTest.exe";
proc.Start();
proc.WaitForExit();
When your code executed it was doing the same as launching "WindowTest
WindowTest.exe" from the command line when from what I can tell all you
really want to run from the command line is "WindowTest.exe", thus why I
removed the Arguments from your proc.StartInfo.
Hope that helps.
David Lancia