惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

小众软件
小众软件
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
WordPress大学
WordPress大学
月光博客
月光博客
Hugging Face - Blog
Hugging Face - Blog
博客园 - 聂微东
博客园 - 【当耐特】
博客园_首页
The Cloudflare Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Apple Machine Learning Research
Apple Machine Learning Research
Last Week in AI
Last Week in AI
酷 壳 – CoolShell
酷 壳 – CoolShell
大猫的无限游戏
大猫的无限游戏
雷峰网
雷峰网
量子位
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tailwind CSS Blog
IT之家
IT之家
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
GbyAI
GbyAI
V
Visual Studio Blog
F
Fortinet All Blogs
Martin Fowler
Martin Fowler

博客园 - CreativeSpirit

VS2015卸载过程实录 C# Body为form-data file文件上传至第三方接口 .NET WebAPI 控制器巧用 GroupName,让 Swagger UI 分类呈现华丽升级 VB.NET实现一键触发另一个窗体按钮点击事件的妙招 VB.net开发必备技能——两个窗体之间的数据传递方法! 掌握VB.net编程技巧,轻松打造Windows应用 TRUEmanager软件开发与维护指南 Oracle高级技巧:使用PIVOT函数和窗口函数解决只查询一条数据的问题 SQL Server 中的二进制转十进制函数编写 web录音——上传录音文件 CEF与JavaScript交互读取电脑信息 CefSharp.WinForms WPF开源框架项目 WPF入门教程系列四 2018年我的第一次年终总结 WPF入门教程系列三 c#串口开发WPF入门教程系列二 WPF入门教程系列一 C#串口通信程序实现无感知签到与答题
C# 调用adb command 读取手机型号和IMEI
CreativeSpirit · 2018-04-25 · via 博客园 - CreativeSpirit

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();
}
}
}