C#, Powershell and console applications - How to handle input during processing
Part of a program that I am creating for myself allows for PowerShell commands and scripts to be run from within the program (no need to open a PowerShell cli because it is already there). For the most part, things work great, I can type in and execute commands and scripts just fine, but if it requires input before the command/script/program is done executing, it fails. What I am currently trying to get working is ftp and I am at a loss. If anyone knows how to get ftp (or similar programs) running through a C# runspace or any resources that explain it, I开发者_开发技巧 would be grateful.
You will need to redirect the console IO streams.
See MSDN entry Process.BeginOutputReadLine for an example of how to get started.
精彩评论