[MonoDevelop] execute external program from C# program

Vincent Arnoux vincent.arnoux at rfo.atmel.com
Fri Jul 1 04:58:19 EDT 2005


Hi,

Alf C Stockton a écrit :

> Please tell me
> 1) If it is possible to call an external program from within an 
> existing C# program.
> 2) If this is possible how does one do it.
>
> In C one would just do an "exec external-program" but I have found 
> nothing similar in C#.
> BTW I am working in Windows not Unix/Linux.

Something like this should do the trick :
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = "C:\\WINNT\\system32\\rsh.exe";
proc.StartInfo.Arguments = "machine -l mylogin ls";
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = false;
proc.Start();
proc.WaitForExit();

Vincent


More information about the Monodevelop-list mailing list