I have a similar problem as already solved here. But I can not figure out, how the problem got solved. I have a program that get paramter the define a input and output file. Running this from Commend line, all works fine:
D:\Tools\siftDemoV4>siftWin32.exe -display < D:\tmp\SrcPgm\image000.pbm > result.pbm
But running via System.Diagnostics.Process, does not work. I get the error "Invalid command line argument: <" and after this a System.InvalidOperationException occurs.
var process = new Process()
{
StartInfo =
{
Arguments = string.Format(@"-display < {0} > {1}", configuration.Source,
configuration.Destination),
FileName = configuration.PathToExternalSift,
RedirectStandardError = true,
RedirectStandardInput = true,
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = true,
ErrorDialog = false,
}
};
process.EnableRaisingEvents = true;
process.Exited += OnProcessExited;
process.OutputDataReceived += new DataReceivedEventHandler(process_OutputDataReceived);
process.ErrorDataReceived += new DataReceivedEventHandler(process_ErrorDataReceived);
process.Start();
process.BeginOutputReadLine();
process.BeginErrorReadLine();
I already tried to write to process.StandardInput after I called process.Start(), but when using the debugger, the external program was sometime already finished (HasExited==true).
Can anybody explain how I can pass this special "<" ">" parameters to the programm?
Best Greetings!
By the way, I checked the path multiple time, they are correct.
The only parameter you need is
-display
Others are not parameters to the program and should be handled by you by usingRedirectStandardInput
andRedirectStandardOutput
E.g
D:\tmp\SrcPgm\image000.pbm
StandardInput
of your processStandardOutput
of your processresult.pbm
Using command redirection operators