adb脚本操作

用荣耀80手机测试

@echo off

setlocal enabledelayedexpansion

adb shell am start com.android.settings

timeout /t 2 /nobreak >nul

adb shell input tap 500 1300

timeout /t 2 /nobreak >nul

adb shell input tap 500 800

timeout /t 2 /nobreak >nul

adb shell input tap 900 350

timeout /t 2 /nobreak >nul

adb shell ps | findstr wifi |findstr hostapd >nul

if %errorlevel% equ 0 (

echo tether exists

) else (

echo tether dont exist

adb shell input keyevent KEYCODE_HOME

adb shell am start com.android.settings

timeout /t 2 /nobreak >nul

adb shell input tap 500 1300

timeout /t 2 /nobreak >nul

adb shell input tap 500 800

timeout /t 2 /nobreak >nul

adb shell input tap 900 350

timeout /t 2 /nobreak >nul

)

netsh wlan connect name=die

timeout /t 2 /nobreak >nul

netsh wlan show interfaces | findstr die >nul

timeout /t 2 /nobreak >nul

if %errorlevel% equ 0 (

echo wifi connect successfully

) else (

echo wifi connection fails

timeout /t 2 /nobreak >nul

netsh wlan connect name=die

)

set d=%data%

set t=%time%

set /A cnt=0

set /A acc=0

set /A num=5

set /A sum=-1

for /f "tokens=*" %%a in ('ping -n !num! www.baidu.com')do (

set /A sum+=1

if !sum! LSS !num! (

if !sum! GTR -1 (

echo %d% %t% %%a>>pi.txt

echo %%a | findstr "TTL" >nul

if %errorlevel% equ 0 (

set /A cnt+=1

set /A acc+=1

echo %d% %t% success now count:!cnt! now acc:!acc! >>log.txt

)

if %errorlevel% NEQ 0 (

set /A cnt+=1

echo %d% %t% fail now count:!cnt! now acc:!acc! >>log.txt

)

)

)

)

pause

相关推荐
KASH_SHADOW11 小时前
8-Mysql的安装与配置
数据库·mysql·adb
活宝小娜18 天前
mysql详细安装教程
数据库·mysql·adb
zhangjin112018 天前
adb install和 pm install 的区别是什么?
adb
炼川淬海DB19 天前
数据库开发规范
android·adb·数据库开发
何极光19 天前
MySQL 8.0详细安装教程(附下载地址)
数据库·mysql·adb
sevencheng79819 天前
【ADB】adb命令行常用按键模拟代码
linux·adb·模拟按键,返回键,音量键
QX_hao20 天前
mysqldump-vs-xtrabackup
adb·mysql备份
云计算磊哥@21 天前
运维开发宝典028-MySQL04数据库热备
数据库·adb·运维开发
charlee4421 天前
Unity在安卓端如何调试输出信息
android·unity·adb·游戏引擎·真机调试
ai_coder_ai22 天前
如何使用adb实现自动化脚本?
运维·adb·自动化