Skip to content

Commit

Permalink
Update scrcpy-console.bat
Browse files Browse the repository at this point in the history
easy to use when multiple devices connected, see Genymobile#3137
  • Loading branch information
MrLeopard authored Aug 3, 2022
1 parent ed84e18 commit 367c984
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions app/data/scrcpy-console.bat
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 367c984

Please sign in to comment.