diff --git a/app/data/scrcpy-console.bat b/app/data/scrcpy-console.bat index b90be29a48..2cc829c97b 100644 --- a/app/data/scrcpy-console.bat +++ b/app/data/scrcpy-console.bat @@ -1,4 +1,58 @@ @echo off +adb start-server +setlocal enabledelayedexpansion + +:list_device + +title Select Device +cls +for /f %%i in ('adb devices ^|find /C "device"') do set /A devices=(%%i-1) +if %devices% GEQ 1 (echo %devices% device^(s^) connected +) else ( + echo no device found & timeout /T 3 >nul & goto :EOF +) +echo following device(s) found: +echo ================================ +set /A no=1 +for /f "skip=1 tokens=1,4 delims= " %%i in ('adb devices -l') do ( + echo !no!: %%j %%i + set deivce!no!=%%i + set model!no!=%%j + set /A no=!no!+1 +) + +echo ================================ + +rem "return" SERIAL +rem usage: adb -s %SERIAL% [command] + +if !no! EQU 2 (set model=!model1! & set SERIAL=!deivce1! &goto title) + +set /a input_max=!no!-1 +echo input device number, default chose is 1 +set input=1 +set /P input= + +if %input% LSS 1 ( + echo must bewtten 1 and !input_max! & timeout /T 2 >nul & goto list_device +) +if %input% GEQ !no! ( + echo must bewtten 1 and !input_max! & timeout /T 2 >nul & goto list_device +) + + +set SERIAL_ord=deivce%input% +set model_ord=model%input% +set SERIAL=!%SERIAL_ord%! +set model=!%model_ord%! +set ANDROID_SERIAL=%SERIAL% + +:title +title %model:~6%---%SERIAL% +pushd %filepath% + + +cls scrcpy.exe %* :: if the exit code is >= 1, then pause if errorlevel 1 pause