Skip to content

Instantly share code, notes, and snippets.

@amitkhare
Created February 23, 2021 13:30
Show Gist options
  • Save amitkhare/9dd178e7b50da9ee9484eb57277c3909 to your computer and use it in GitHub Desktop.
Save amitkhare/9dd178e7b50da9ee9484eb57277c3909 to your computer and use it in GitHub Desktop.
opens scrcpy in WiFi mode. node - mobile needs to be connected through USB at first.
@echo off
adb.exe kill-server
netsh wlan show interfaces | Findstr /c:"Signal" && set "CStatus=true" || set "CStatus=false"
for /f "tokens=2,3 delims={,}" %%a in ('"WMIC NICConfig where IPEnabled="True" get DefaultIPGateway /value | find "I" "') do set "location=%%a"
set location=%location:"=%
ping 127.0.0.1 -n 2 > nul
adb.exe devices
IF /i "%CStatus%"=="true" echo %location%
ping 127.0.0.1 -n 3 > nul
IF /i "%CStatus%"=="true" adb.exe tcpip 5555
IF /i "%CStatus%"=="true" adb.exe connect %location%:5555
ping 127.0.0.1 -n 1 > nul
IF /i "%CStatus%"=="true" scrcpy.exe --bit-rate 15M --max-size 1280 --max-fps 60 --turn-screen-off --stay-awake --show-touches
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment