using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;

namespace ExecuteADB
{
public partial class Form1 : Form
{
//声明变量
string preimei, imei;
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{

}

/// <summary>
/// 点击获取IMEI 号码
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button1_Click(object sender, EventArgs e)
{
String cmd = Application.StartupPath + "\\adb\\adb.exe";
Process p = new Process();
p.StartInfo = new System.Diagnostics.ProcessStartInfo();
p.StartInfo.FileName = cmd;//设定程序名
p.StartInfo.Arguments = " shell getprop ro.product.model";
p.StartInfo.UseShellExecute = false; //关闭shell的使用
p.StartInfo.RedirectStandardInput = true; //重定向标准输入
p.StartInfo.RedirectStandardOutput = true; //重定向标准输出
p.StartInfo.RedirectStandardError = true; //重定向错误输出
p.StartInfo.CreateNoWindow = true;//设置不显示窗口
p.Start();
label2.Text = p.StandardOutput.ReadToEnd();
p.Close();
///////////////////////////
p.StartInfo = new System.Diagnostics.ProcessStartInfo();
p.StartInfo.FileName = cmd;//设定程序名
p.StartInfo.Arguments = " shell dumpsys iphonesubinfo";
p.StartInfo.UseShellExecute = false; //关闭shell的使用
p.StartInfo.RedirectStandardInput = true; //重定向标准输入
p.StartInfo.RedirectStandardOutput = true; //重定向标准输出
p.StartInfo.RedirectStandardError = true; //重定向错误输出
p.StartInfo.CreateNoWindow = true;//设置不显示窗口
p.Start();
preimei = p.StandardOutput.ReadToEnd();

//string[] sArray = preimei.Split(new char[1] { '=' });
//imei = sArray[2];
//textBox1.Text = imei.Trim();
//p.Close();
}
}
}

C# 调用adb command 读取手机型号和IMEI的更多相关文章

  1. python调用adb命令进行手机操作

    Python中执行cmd命令可以用到os和subprocess两个模块. 区别在于os是阻塞式的,subprocess是非阻塞式的,所以一般我们使用subprocess是比较适合的. 接下来我先举一个 ...

  2. python学习之——调用adb命令完成移动端界面测试

    实现原理 Hierarchy Viewer:获得当前手机实时的UI信息,方便用于手机的自动化测试: python中的subprocess.Popen():调用系统命令: uiautomator工具:获 ...

  3. dos保存adb logcat读取的Android信息

    /***************************************************************************** * dos保存adb logcat读取的A ...

  4. 解决adb command not found以及sdk环境配置

    解决adb command not found以及sdk环境配置 分类: mark 2013-10-02 09:41 2975人阅读 评论(0) 收藏 举报 原文地址:http://www.cnblo ...

  5. ionic打包apkFailed to execute shell command "input,keyevent,82"" on device: Error: adb: Command failed with exit code 137

    错误代码如下 BUILD SUCCESSFUL in 12s 46 actionable tasks: 1 executed, 45 up-to-date Built the following ap ...

  6. 【python】python调用adb

    本期分享下python如何调用adb: 1.导入os模块 import os 2.python中调用adb命令语法 print("显示机型信息:") os.system('adb ...

  7. 如何通过adb command 完成自动SD卡升级?

    如何通过adb command 完成自动SD卡升级? 原创 2014年09月09日 10:50:57 2746 通过adb 命令的方式,免去了按powerkey+volumeup进入menu sele ...

  8. 使用adb shell 进入手机修改文件的权限

    1.将android的tools目录加入到path中,或者直接在adb.exe路径下启动cmd窗口2.adb shell 进入手机后,发现是 $ ,不是 # 号3.在进入shell后运行 su ,就可 ...

  9. iOS获取手机型号,类似iphone 7这种 含swift和OC

    获取手机设备信息,如name.model.version等,但如果想获取具体的手机型号,如iphone5.5s这种,就需要如下这种 swift: func phonetype () -> Str ...

随机推荐

  1. Git命令使用指南

    继续git相关的东西,网上很多讲解的,但是还是喜欢这个图:(爱屋及乌,当然内容也很好,文章链接:http://me.iblogc.com/2015/01/16/Git命令使用指南/) Git是软件开发 ...

  2. String.Format,DateTime日期时间格式化

    DateTime dt = DateTime.Now;//2010年10月4日 17点05分            string str = "";            //st ...

  3. 洛谷 P1598 垂直柱状图【字符串】

    题目描述 写一个程序从输入文件中去读取四行大写字母(全都是大写的,每行不超过72个字符),然后用柱状图输出每个字符在输入文件中出现的次数.严格地按照输出样例来安排你的输出格式. 输入输出格式 输入格式 ...

  4. UVA 839 Not so Mobile (递归建立二叉树)

    题目连接:http://acm.hust.edu.cn/vjudge/problem/19486 给你一个杠杆两端的物体的质量和力臂,如果质量为零,则下面是一个杠杆,判断是否所有杠杆平衡. 分析:递归 ...

  5. 【费用流】bzoj3280 小R的烦恼

    类似bzoj1221 http://www.cnblogs.com/autsky-jadek/p/4174087.html 只不过大学有多个,所以我们另开一个节点汇总所有'S->大学'的边,然后 ...

  6. python3开发进阶-Django框架的起飞加速一(ORM)

    阅读目录 ORM介绍 Django中的ORM ORM中的Model ORM的操作 一.ORM介绍 1.ORM概念 对象关系映射(Object Relational Mapping,简称ORM)模式是一 ...

  7. jdk8中Spliterator的作用

    文章前半部分转自:https://blog.csdn.net/lh513828570/article/details/56673804 之前的时候看集合部分源码没看完,今天又翻了一下,看到了个东西sp ...

  8. RxJava 1.x 理解-3

    在 RxJava 1.x 理解-1 中,我们说到了RxJava的简单用法,但是这还远远不够,因为 输入的数据 ---> 被监听者(订阅源)对这些数据进行操作,或者执行响应的处理 --> 产 ...

  9. 对象数组的初始化:null reference

    今天写代码的时候,发现我写的对象数组,只声明,而没有初始化,所以记录一下这个问题:null reference. Animals [] an=new Animals[5];//这只是个对象类型数组的声 ...

  10. ZK的数据结构特点

    ZK的数据结构特点 ZooKeeper这种数据结构有如下这些特点: 1. 每个子目录项如NameService都被称作znode,这个znode是被它所在的路径唯一标识,如Server1这个znode ...