C# proc.StandardOutput.ReadToEnd()不';不要拆线

C# proc.StandardOutput.ReadToEnd()不';不要拆线,c#,cmd,testim.io,C#,Cmd,Testim.io,你能帮我理解我运行代码的错误吗? 我希望从C#构建的应用程序中恢复CMDShell的输出字符串,并且我在一个字符串中获得所有内容,而不需要分隔行。 我正在运行CLI进行自动测试。 请参阅所附代码和图片。 先谢谢你。 s字符串: Microsoft Windows [Version 10.0.16299.431] (c) 2017 Microsoft Corporation. All rights reserved. C:\Users\evgen\source\repos\testim_ex1\

你能帮我理解我运行代码的错误吗? 我希望从C#构建的应用程序中恢复CMDShell的输出字符串,并且我在一个字符串中获得所有内容,而不需要分隔行。 我正在运行CLI进行自动测试。 请参阅所附代码和图片。 先谢谢你。 s字符串:

Microsoft Windows [Version 10.0.16299.431]
(c) 2017 Microsoft Corporation. All rights reserved.

C:\Users\evgen\source\repos\testim_ex1\testim_ex1\bin\Debug>testim --token "98IQGMuu1jTaBp3HvIMkmsk6tTa2jrS4hUFE247rX9ef0s3FAp" --project "KsfNpLJSbdNlY8czyuwb" --host "ondemand.testim.io" --port 4444 --report-file testim-report.xml --label  "EvgenyShai"
Starting Testim.io CLI
Warning: You are using version 1.16.0, a newer version is available. To update please run npm install (npm install -g @testim/testim-cli)
-----------------------------------------------------------------------
Running Project: KsfNpLJSbdNlY8czyuwb Label: [ 'EvgenyShai' ] Branch: master
-----------------------------------------------------------------------
Batch execution huueFFGwEk was created
Got batch to run:
     1 : Search show in eztv (3gHheApBMO)
-----------------------------------------------------------------------
W:1 Test Search show in eztv started (3gHheApBMO) url: https://app.testim.io/#/project/KsfNpLJSbdNlY8czyuwb/branch/master/test/3gHheApBMO?result-id=2ox8E7Emku
W:1 Get browser Search show in eztv
W:1 Wait for test start
W:1 Wait for test complete
W:1 Test Search show in eztv finished status: PASSED (3gHheApBMO) duration: 0:0:0:17.955
-----------------------------------------------------------------------
Execution completed id: huueFFGwEk Label: [ 'EvgenyShai' ] Duration: 0:0:0:32.945 PASSED: 1 FAILED: 0
-----------------------------------------------------------------------
JUnit XML file saved to testim-report.xml
C:\Users\evgen\source\repos\testim\u ex1\testim\u ex1\bin\Debug>

private void B_RunTest_Click(object sender, EventArgs e)
{
    ProcessStartInfo psi = new ProcessStartInfo("cmd");
    psi.UseShellExecute = false;
    psi.RedirectStandardOutput = true;
    psi.RedirectStandardError = true;
    psi.CreateNoWindow = true;
    psi.RedirectStandardInput = true;

    var proc = Process.Start(psi);
    t = TB_CLIstring.Text.ToUpper();

    if (t == "CLS")
    {
       proc.StandardInput.WriteLine(TB_CLIstring.Text);
       proc.StandardInput.Flush();
       proc.StandardInput.Close();
       TB_CMD_Output.Text = "";
    }
    else
    {

        proc.StandardInput.WriteLine(TB_CLIstring.Text);
        proc.StandardInput.Flush();
        proc.StandardInput.Close();

        s = proc.StandardError.ReadToEnd() + proc.StandardOutput.ReadToEnd();

        TB_CMD_Output.Text = s;
    }
}
应该如何:


情况如何:


能否从
s=proc.StandardError.ReadToEnd()+proc.StandardOutput.ReadToEnd()添加转义字符串对您的问题的回答?可能重复此问题是否仍然是您需要帮助的问题?