Last active
August 11, 2018 17:27
-
-
Save thebagchi/a4d8b6ce4e30c13512da to your computer and use it in GitHub Desktop.
issue command on selected device without looking up adb devices
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
@echo off | |
SET ARGUMENTS=%~1 | |
if "%ARGUMENTS%" == "" ( | |
GOTO EOF | |
) | |
SET "ARGUMENTS=%ARGUMENTS:""="%" | |
SETLOCAL ENABLEDELAYEDEXPANSION | |
:: INSTALL ON ALL ATTACHED DEVICES :: | |
FOR /F "tokens=1,2 skip=1" %%A IN ('adb devices') DO ( | |
SET IS_DEV=%%B | |
if "!IS_DEV!" == "device" ( | |
SET SERIAL=%%A | |
SET TRUTH="FALSE" | |
SET /P INPUT="USE DEVICE: !SERIAL! (Y/N)" | |
if "!INPUT!" == "Y" ( | |
SET TRUTH="TRUE" | |
) | |
if "!INPUT!" == "y" ( | |
SET TRUTH="TRUE" | |
) | |
if !TRUTH! == "TRUE" ( | |
echo "adb -s !SERIAL! %ARGUMENTS%" | |
call adb -s !SERIAL! %ARGUMENTS% | |
GOTO EOF | |
) | |
) | |
) | |
ENDLOCAL | |
:EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to run this script in windows. Need to save this file? If yes how to save this?