UseShellExecute
must be set to false
to redirect IO, and to true
to use the Verb
property. So you can’t.
But this article seems do the magic, although I haven’t tested it.
It’s written in C++, but a wrapper API can easily be created to be called from C# by using DllImport
.
Note: If you want to pass data between the two programs and have access to the target program’s source code, you can easily re-design you application to use Named Pipes
instead of redirecting standard I/O.