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

相关推荐
北冥有鱼被烹1 天前
【微知】rokid glass如何开启无线adb进行APP安装
adb
STER labo2 天前
mysql配置环境变量——(‘mysql‘ 不是内部或外部命令,也不是可运行的程序 或批处理文件解决办法)
数据库·mysql·adb
sjmaysee2 天前
CentOS7安装Mysql5.7(ARM64架构)
adb·架构
AtOR CUES3 天前
MySQL——表操作及查询
android·mysql·adb
mOok ONSC3 天前
mysql9.0windows安装
windows·adb
xxjj998a3 天前
Laravel8.x核心特性详解
数据库·mysql·adb
TeDi TIVE3 天前
Linux下MySQL的简单使用
linux·mysql·adb
TeDi TIVE3 天前
MySQL四种备份表的方式
mysql·adb·oracle
rleS IONS3 天前
Linux系统离线部署MySQL详细教程(带每步骤图文教程)
linux·mysql·adb
计算机安禾3 天前
【Linux从入门到精通】第40篇:LAMP/LNMP环境一键部署脚本实战
android·linux·adb