[Mono-list] Running System processes from within mono

Jonathan Pryor jonpryor at vt.edu
Mon Jun 26 06:10:08 EDT 2006


On Sat, 2006-06-24 at 15:06 -0400, Lee wrote:
> Can someone provide a sample of calling an external application from within
> a C# app?
> 
> I've tried a vew simple things like:
> 
> System.Diagnostics.Process.Start("shutdown -r now");

This will only work for programs which are in your $PATH, and `shutdown'
usually isn't in the normal path (it's in /sbin, and */s* directories
are usually omitted from $PATH because they're for use by sysadmins).

Try using the full path, e.g.

	System.Diagnostics.Process.Start ("/sbin/shutdown -r now");

Also, your program will likely need to be running as `root' in order for
the `shutdown' invocation to actually do anything...

 - Jon




More information about the Mono-list mailing list