-
-
Save mustafakibar/c24af6390a5c83410d9f95873453515f to your computer and use it in GitHub Desktop.
Run ADB shell command with options on all connected 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
:: Inpired by Windows version https://gist.github.com/thebagchi/df29ae862fc1c296dec2 | |
:: Which is inspired by Linux version of the same https://gist.github.com/christopherperry/3208109 | |
@echo off | |
SET ARGUMENTS=%* | |
if "%ARGUMENTS%" == "" ( | |
GOTO EOF | |
) | |
SET "ARGUMENTS=%ARGUMENTS:""="%" | |
SETLOCAL ENABLEDELAYEDEXPANSION | |
:: EXECUTE SHELL COMMAND 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 | |
echo "adb -s !SERIAL! shell %ARGUMENTS%" | |
call adb -s !SERIAL! shell %ARGUMENTS% | |
) | |
) | |
ENDLOCAL | |
:EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment