[Mono-list] command line apps from ASP.NET

Chris Aitken chris at ion-dreams.com
Fri Jul 22 10:09:01 EDT 2005


> > But when: GACRead.StartInfo.Arguments = " -l | grep Version=1; It 
> > returns nothing. Same result regardless of what is grep'd for.
> 
> The | character is used to redirect the output of one command 
> to another. It is not an argument for the executable it is 
> interpreted by the shell.

Of course! It's one of those days.
 
> Also note that you are using UseShellExecute = true (default) 
> in the first example while you are using UseShellExecute = 
> false in the second example.
> The first one works because it will execute the shell and 
> pass both FileName and Arguments to the shell as the arguments.

In the second (the C# source for an asp.net page), I am using 

GACRead.StartInfo.RedirectStandardOutput = true; To use this,
UseShellExecute must be false, else the error:

System.InvalidOperationException: UseShellExecute must be false when
redirecting I/O.

> I think you should put the entire command line to FileName 
> and use UseShellExecute = true (default).

I get the error:

System.ComponentModel.Win32Exception: Cannot find the specified file

If I put the entire command within the FileName (obviously with
UseShellExecute = false;).

Thanks,

Chris


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



More information about the Mono-list mailing list