/*----------------////File name: method/////File Function Description:////////////use ADB for file interaction between Android device and PC side, specific ADB command operation please Baidu check////////Create Logo: 2014052 6////////Modify the Logo:///Modify the Description:
// //----------------------------------------------------------------*/
string cmd = Directory.getcurrent Directory (); cmd = cmd. Substring (0, CMD. IndexOf ("bin\\")) + @ "Platform-tools\adb.exe"; ProcessStartInfo psi = new Process StartInfo (cmd, "get-state"); PSI. CreateNoWindow = true;//does not display DOS command line window PSI. Redirectstandardoutput = true;// PSI. Redirectstandardinput = true;// PSI. UseShellExecute = false;//Specifies whether the operating system Shell process initiation process Process P = process.start (PSI); nbsp StreamReader reader = p.standardoutput;//intercept output stream &NB Sp String line = reader. ReadLine ();//read one line at a time //while (!reader. EndOFStream) //{ //Console.Out.WriteLine (li NE); //line = reader. ReadLine (); //} if (!line. Equals ("Device")) { MESSAG Ebox.show ("The device is not ready, please check that the data cable is properly connected to the computer and try again", "Device Not Ready", MessageBoxButtons.OK, Messageboxicon.error); return; } &NB Sp Directory.CreateDirectory ("D://file"); PSI. arguments= "Pull/sdcard/file/d:/file"; p = Process.Start (PSI); &NBS P p.WaitForExit (); p.close ();//close process &NB Sp Reader. Close ();//Closed Flow
C # Operation DOS command, and get processing return value