[Mono-list] How to Start Concatenated Processes by Using System.Diagnostics.Process?

Jonathan Pryor jonpryor at vt.edu
Fri Jun 18 08:10:04 EDT 2010


On Fri, 2010-06-18 at 11:13 +0200, Jacek Rużyczka wrote:
> Am Donnerstag 17 Juni 2010 16:25:04 schrieb Robert Jordan:
> > This. Or pass the commands to a shell process (untested):
> > 
> > ProcessStartInfo info = new ProcessStartInfo();
> > info.UseShellExecute = false;
> > info.FileName = "/bin/bash";
> > info.Arguments = "-c 'pdflatex -interaction=nonstopmode receipt_60.tex
> > && gpg ... '";
> > 
> > Note the quoting of the string for the -c option and latex
> > -interaction switch.
> > 
> OK, thanks. The bash solution, I'm afraid, will not work for me as my app will 
> also run on Windows, and I can hardly require my Windows users to install 
> MinGW.

CMD.EXE also accepts a '/C STRING' argument list, so you could do a
platform check and use /bin/bash on Unixy platforms and CMD.EXE on

The only alternate choice I know of is to do things "manually," with one
Process instance per command, during which you'd need to redirect Stdout
and Stdin, and "manually pipe" between them.  This wouldn't be very
efficient, but should otherwise Just Work.

 - Jon

More information about the Mono-list mailing list