System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.FileName = "cmd.exe";
pp.StartInfo.Arguments = "/c adb shell ls -l /sdcard/music/";
p.StartInfo.RedirectStandardError = true;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.Start();
StreamReader outputWriter = p.StandardOutput;
String errorReader = p.StandardError.ReadToEnd();
String line = outputWriter.ReadLine();
while (line != null)
{
using (TextReader tr = new StringReader(str))
{
string Line;
while ((Line = tr.ReadLine()) != null)
{
String[] temp = Line.Split(' ');
listview1.Items.Add(new ListViewItem(temp));
}
}
line = outputWriter.ReadLine();
C# 执行adb 命令
最新推荐文章于 2025-05-20 17:00:54 发布