c# - 带有 -RedirectStandardOutput 的 powershell 启动进程挂起 powershell 控制台
问题描述
我有一个用c#写的test.exe,代码就是调用Console.ReadLine(); 我想跑:
$p = Start-Process test.exe -RedirectStandardOutput .\out.txt -PassThru
在没有 -RedirectStandardOutput 的情况下运行时:
$p = Start-Process test.exe -PassThru
一切看起来都很好。
但如果:
$p = Start-Process test.exe -RedirectStandardOutput .\out.txt -PassThru
powershell 控制台挂起,您无法输入任何内容,直到您关闭 test.exe 命令提示符。
为什么会发生这种情况,无论如何可以保持 test.exe 运行,我仍然可以使用 powershell 控制台?
解决方案
推荐阅读
- unix - 如何通过使用 awk 截断每条记录的小数位来对浮点值求和?
- typescript - TypeOrm cascade:当我从数据库中删除表时,true 不会从其他表中删除它的关系
- angular - 离子排除 *ngFor 中的元素
- c++ - 你能允许一个类重新定义吗
- javascript - 访问 indexedDB SQLite 文件以供用户本地下载
- javascript - Font Awesome + Angular:不允许使用空表达式
- azure - 使用 Azure Devops Pipeline 将标签(带空格)传递给 ARM 模板
- python - 用 Ratio Proportion 填充 NAN 值
- java - PL/SQL 游标循环获取到 java
- ios - 带有 ForEach 删除动画的 SwiftUI 自定义列表不起作用