adb 脚本

1、打印可以ping到的IP地址

 

@echo off
set a=1
:start
echo %a% \\把a打印到shell
ping 172.19.5.%a% -w 1 -n 1|find /i "Lost = 1"&&set c=1||set c=0
if %c%==0 (echo 172.19.5.%a% >>IP.txt) \\ 把ip地址保存到IP.txt
set /a a=%a%+1
if %a%==255 exit
goto :start

2、adb 脚本语法

 

set b=1
:1
if %b% equ b exit
adb shell input tap 581 266
adb shell input tap 1185 266 \\ 坐标
adb shell sleep 15 \\暂停
adb shell input swipe 100 100 200 200 200 \\坐标及时间
set /a b+=1
goto 1

3、想要让一个bat脚本无限循环可以效仿1、2或者在脚本末尾添加   %0

 

@ echo off
set b = 11
adb shell input tap 952 445
adb shell input text WWww@#123124 
adb shell input tap 1781 391
set /a b+=1
adb shell sleep 0.5
adb shell screencap -p /sdcard/screen.png
adb pull /sdcard/screen.png C:\Users\v-wutaotao\Desktop\qhidtest\%b%screen.png
%0

4、android设备截图并保存在本地

 

adb shell screencap -p /sdcard/screenshot.png
adb pull /sdcard/screenshot.png D:\png\screenshot.png
set d=%date:~0,10%
set filename=%date:~0,10%_%time:~0,2%_%time:~3,2%_%time:~6,2%.png
set filename=%filename:/=-%
echo %filename%
ren D:\png\screenshot.png %filename%
REM pause

 

 

........未完待续.....

 

posted @ 2018-09-14 17:35  sin涛涛  阅读(875)  评论(0编辑  收藏  举报