adb控制手機螢幕滑動(批處理)

2022-05-07 06:48:15 字數 2235 閱讀 9833

1、通過 wlan 連線到裝置

將 android 裝置和 adb 主機連線到這兩者都可以訪問的同一 wlan 網路。請注意,並非所有接入點都適用;您可能需要使用防火牆已正確配置為支援 adb 的接入點。

如果您要連線到 wear os 裝置,請關閉與該裝置配對的手機上的藍芽。

使用 usb 資料線將裝置連線到主機。

設定目標裝置以監聽埠 5555 上的 tcp/ip 連線。

adb tcpip 5555

拔掉連線目標裝置的 usb 資料線。

找到 android 裝置的 ip 位址。例如,對於 nexus 裝置,您可以在設定>關於平板電腦(或關於手機)>狀態>ip 位址下找到 ip 位址。或者,對於 wear os 裝置,您可以在設定>wlan 設定>高階>ip 位址下找到 ip 位址。

通過 ip 位址連線到裝置。

adb connect device_ip_address

確認主機已連線到目標裝置:

$ adb devices

list of devices attached

device_ip_address:5555 device

現在,您可以開始操作了!

如果 adb 連線斷開:

確保主機仍與 android 裝置連線到同乙個 wlan 網路。

通過再次執行adb connect步驟重新連線。

如果上述操作未解決問題,重置 adb 主機:

adb kill-server

然後,從頭開始操作。

2、寫批處理:

批處理**:

@rem 生成隨機數

@echo off

@rem 設定延遲變數

setlocal enabledelayedexpansion

set min=15

set max=30

set /a mod=!max!-!min!+1

for /l %%i in (1,1,100) do

( set /a r=!random!%%!mod!+!min!

echo !r!

ping -n !r! 127.0.0.1>nul

@rem 命令adb shell input swipe

340865

370202

adb shell input swipe

340865

370202

)

公升級版:

獲取螢幕座標:

1.手機自帶的隱私--開發者工具--顯示指標(一般安卓4.0以上的都有這個選項)

2.monkeyrunner錄製時獲取,開啟monkeyrecorder,隨便點選都能在右側出現相應的座標

點選指定位置:

adb shell input tap x y

公升級版:開啟快手

@rem 生成隨機數

@echo off

@rem 設定延遲變數

setlocal enabledelayedexpansion

set min=5

set max=11

set /a mod=!max!-!min!+1

@rem 開啟快手

adb shell am start -n com.kuaishou.nebula/com.yxcorp.gifshow.homeactivity

@rem 暫停5秒

ping -n 5 127.0.0.1>nul

for /l %%i in (1,1,10000) do (

set /a r=!random!%%!mod!+!min!

@rem set t=%time:~0,8%

@rem echo !t!

echo %%i:!r!

adb shell input tap 350 765

ping -n !r! 127.0.0.1>nul

@rem 命令adb shell input swipe 340 865 370 202

adb shell input swipe 340 665 370 152

)

adb 模擬手機滑動事件

chcp 65001 echo off echo 開始滑動 set str 0 start adb shell input swipe 100 150 100 100 choice t 1 d y n nul set a str 1 clsecho 滑動次數 str goto start複製上邊 到...

控制手機螢幕

現以完成pc 與 android usb 的 socket 通訊 需要 pc 時時顯示螢幕 並控制手機螢幕 不知total control這類程式是 通過apk 時時抓圖 傳輸控制呢還是 向網上說的ip方式?ip 方式應該是wifi 環境下 那麼 usb環境下 是怎樣 實現的呢?知道的大大告訴下 通...

流程控制 批處理

declare numss number begin select count into numss from tcaudit t where t.entid c.getentid if numss 0 then insert into tcaudit entid,isaudit values c....