简体   繁体   中英

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM