zoukankan      html  css  js  c++  java
  • c#如何用代码开启cmd指定命令(如:运行一个手机adb shell命令)

     else if (this.Mode == TravelMode.AutoRecodeMode) 
                {
                    DateTime StartDate = DateTime.Now;
                    string args = string.Format(" -jar "{4}" {0} {1} {2} {3}",
                    this.SerialNumber, this.ScreenSize.Width, this.ScreenSize.Height, this.PackageName, jarLocation);
                    //string args = @"-jar " +@"E:1010NewAppTestinDebugadbTraversalApp.jar"+ " IJAEZ9INS8EUHMVK 720 1280 com.android.calculator2";
    
    #if DEBUG
                    System.Console.WriteLine(string.Format("[AndroidTraveler] ExecuteScript() -> AutoRecodeMode Args:{0}", args));
    #endif
                    //声明一个程序信息类
                    System.Diagnostics.ProcessStartInfo Info = new System.Diagnostics.ProcessStartInfo();
                    //设置外部程序名
                    Info.FileName = "java.exe";
                    Info.RedirectStandardInput = true;
                    Info.UseShellExecute = false;
                    Info.Arguments = args;
                    //声明一个程序类
                    System.Diagnostics.Process Proc;
                    try
                    {
                        //启动外部程序   
                        Proc = System.Diagnostics.Process.Start(Info);
                        Proc.WaitForExit();
                    }
                    catch (System.ComponentModel.Win32Exception exc)
                    {
                        Console.WriteLine("系统找不到指定的程序文件。
    {0}", exc);
                    }               
  • 相关阅读:
    POJ2524+并查集
    POJ3697+BFS+hash存边
    POJ1151+线段树+扫描线
    POJ2528+线段树
    ubuntu 和 win7 远程登陆 + vnc登陆
    POJ3690+位运算
    POJ3283+字典树
    POJ3282+模拟
    POJ2349+prim
    2016.6.13
  • 原文地址:https://www.cnblogs.com/lqsilly/p/3364813.html
Copyright © 2011-2022 走看看