[Mono-list] Problem with System.Diagnostics.Process and cat

Robert Jordan robertj at gmx.net
Mon Jun 23 13:25:39 EDT 2008


snorkel01 wrote:
> Hi,
> I am trying to use System.Diagnostics.Process and the Unix cat command to
> concatentate two files and I can't seemt to get it to work.
> 
>  myStartInfo.FileName = "cat";
>  myStartInfo.Arguments = string.Format("{0} {1} > {2}", newSFXstub,
> zipfilename, newSFXFilename);
> 
> The arguments in this case are: 
> /1001/temp/admstub_23849.exe/1001/temp/miadm_23849.zip  >
> /1001/temp/admsfx_23849.exe

You need a shell for stream redirection:

string cmd = String.Format("{0} {1} > {2}", newSFXstub, zipfilename, 
newSFXFilename);
myStartInfo.FileName = "/bin/sh";
myStartInfo.Arguments = String.Format("-c \"{0}\"", cmd);

Robert



More information about the Mono-list mailing list