开发者

C#, Powershell and console applications - How to handle input during processing

开发者 https://www.devze.com 2023-01-23 23:44 出处:网络
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 mos

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消