shell语言常用简单实现安卓手机终端的简单操作语句.bat

时间:2021-09-08 09:31:20

最简单操作安卓手机终端的脚本语言,简单粗暴,缺点就是不支持实体键、判断等功能;大家可以举一反三


android常用操作语法如下:

1.循环语句(20次)

for /l %%a in (1,1,20) do(
............................................
............................................

2.休眠语句(5秒)

ping -n 5 127.0.0.1

adb shell sleep 1


3.点击某坐标(x:930 y:496)

adb shell input tap 930 496 #


4.重启

adb reboot


5.点击按实体键(BACK键/返回键,其他的键通用百度有,或者自己抓日志查看)

adb shell input keyevent KEYCODE_BACK

adb shell input keyevent 4


6.长按某坐标操作/长按连拍(x:554 y:1756 x1:555 y1:1757 1000ms)

adb shell input swipe 554 1756 555 1757 1000


7.等待终端连接

adb wait-for-device

8.打开应用(该应用包名:com.android.phone)

adb shell am start com.android.phone


9.退出应用(该应用包名:com.android.phone)

adb shell am force-stop com.android.phone


实例1:

@echo 终端自动重启1000次

for /l %%a in (1,1,1000) do (
adb wait-for-device
adb reboot
)

实例2:

@echo 在待机界面,拨号连续进入、输入内容退出20次_四科_邓盛誉

for /l %%a in (1,1,20) do (

adb shell input tap 153 1734 #

adb shell input tap 247 1150 #

adb shell input tap 551 1149 #

adb shell input tap 886 1131 #

adb shell input tap 221 1305 #

adb shell input tap 536 1273 #

adb shell input tap 874 1307 #

adb shell input tap 207 1485 #

adb shell input tap 555 1482 #

adb shell input tap 904 1407 #

adb shell input tap 216 1634 #

adb shell input tap 545 1648 #

adb shell input tap 878 1638 #

ping -n 2 127.0.0.1
adb shell input keyevent KEYCODE_BACK


)


pause