使用 Visal sturdio 进行快速启动命令

问题描述 投票:0回答:1

Fastboot'

getvar all
返回富文本。

这是我的代码:

Process p = new Process();

p.StartInfo.FileName = "fastboot.exe";

p.StartInfo.Arguments = "getvar all";
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UseShellExecute = false;

p.StartInfo.StandardOutputEncoding = System.Text.Encoding.ASCII;
p.Start();
StreamReader d = p.StandardOutput;
richTextBox1.Text = d.ReadToEnd();
richTextBox1.Text = p.StandardOutput.ReadToEnd();
p.WaitForExit();

但是,富文本始终为空。

c# android vb.net command fastboot
1个回答
0
投票

需要文件Fastboot.exe
苏海尔0910

            Process process = new Process();
            ProcessStartInfo startInfo = new ProcessStartInfo();
            startInfo.WindowStyle = ProcessWindowStyle.Hidden;
            startInfo.CreateNoWindow = true;
            startInfo.UseShellExecute = false;
            startInfo.RedirectStandardOutput = true;
            startInfo.RedirectStandardError = true;
            startInfo.FileName = "fastboot.exe";
            startInfo.Arguments = "reboot";
            process.StartInfo = startInfo;
            process.Start();


            StreamReader readerStdError1 = process.StandardError;
            StreamReader readerStdOutput1 = process.StandardError;

            output1 = readerStdError1.ReadToEnd() + readerStdOutput1.ReadToEnd();
            process.WaitForExit();

            Console.WriteLine(output1);
© www.soinside.com 2019 - 2024. All rights reserved.