forked from Genymobile/scrcpy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
easy to use when multiple devices connected, see Genymobile#3137
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
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 |