Last active
June 24, 2019 04:10
-
-
Save nosix/e01c69bd3b673de3af5c3c8b9adbbd99 to your computer and use it in GitHub Desktop.
Batch file to start Android device screen capture. Please put it in the scrcpy folder and execute it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
cd %~dp0 | |
setlocal | |
set CMD=adb devices | |
for /f "usebackq tokens=1,2,3*" %%a in (`%CMD%`) do ( | |
if "%%b" == "device" ( | |
set DEVICE_ID=%%a | |
) | |
) | |
echo %DEVICE_ID% | |
if "%%DEVICR_ID:5555=%%" == "%%DEVICE_ID%%" ( | |
timeout /t 1 > nul | |
adb tcpip 5555 > nul | |
timeout /t 1 > nul | |
set CMD=adb shell ip addr show wlan0 | |
for /f "usebackq tokens=1,2,3*" %%a in (`%CMD%`) do ( | |
if "%%a" == "inet" ( | |
for /f "tokens=1,2 delims=/" %%i in ("%%b") do ( | |
set IPV4_ADDR=%%i | |
) | |
) | |
) | |
echo %IPV4_ADDR% | |
timeout /t 1 > nul | |
adb connect %IPV4_ADDR%:5555 | |
) | |
timeout /t 1 > nul | |
scrcpy -s%DEVICE_ID% -c 1210:1100:140:180 | |
endlocal |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment