c# - StandardOutput.ReadToEnd() 始终为 NULL
问题描述
我有这个功能的问题。它应该将安装命令输出到文本框,但install.StandardOutput.ReadToEnd()
始终是null
.
我得到错误:Expression cannot be evaluated because there is a native frame at the top of the call stack
你能帮我解决这个问题吗?
Process install = new Process();
install.StartInfo.FileName = "cmd.exe";
install.StartInfo.UseShellExecute = false;
install.StartInfo.Arguments = "/all";
install.StartInfo.CreateNoWindow = true;
install.StartInfo.RedirectStandardInput = true;
install.StartInfo.RedirectStandardOutput = true;
install.Start();
if (CB_MultiADB.Checked == true)
{
install.StandardInput.WriteLine("FOR /F \"skip=1\" %%x IN ('adb devices') DO start cmd.exe @cmd /k" + InstallOption + InstallPfad + "\"");
}
else
{
install.StandardInput.WriteLine("adb install" + InstallOption + InstallPfad + "\"");
InstallAusgabe = install.StandardOutput.ReadToEnd();
string Index = "adb install";
int Indexnr = InstallAusgabe.IndexOf(Index);
string SubInstall = InstallAusgabe.Substring(Indexnr, 100);
TB_Ausgabe.Text = SubInstall;
}
解决方案
推荐阅读
- macos - 无法在 macOS Catalina 上找到 adb
- .net - 从用户机密获取 ApplicationInsights 设置
- python - 删除语音助手后端的mp3文件
- stripe-payments - 当 SetupIntent 成功时,PaymentIntent 需要身份验证 - Stripe
- r - R 中的 ShinyApp - 具有 1 级因子的单选按钮输入的对比度误差
- javascript - 我想用 ejs 将数据库中的数据打印到元素中
- javascript - ReactJS - 反应树图不呈现树
- google-oauth - 谷歌广告 API 身份验证失败 - “PERMISSION_DENIED”
- arrays - 如何正确加载图像以进行物体检测?
- reactjs - 将动态颜色传递给 Material-UI Icon