Skip to content

Instantly share code, notes, and snippets.

@thebagchi
Last active December 28, 2021 05:29
Show Gist options
  • Save thebagchi/df29ae862fc1c296dec2 to your computer and use it in GitHub Desktop.
Save thebagchi/df29ae862fc1c296dec2 to your computer and use it in GitHub Desktop.
script for issuing commands to multiple android devices on windows
:: Inspired by Linux version of the same https://gist.github.com/christopherperry/3208109
@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
echo "adb -s !SERIAL! %ARGUMENTS%"
call adb -s !SERIAL! %ARGUMENTS%
)
)
ENDLOCAL
:EOF
@thebagchi
Copy link
Author

Please check

  • device is connected
  • developer option enabled
  • usb debugging on
  • windows driver is installed.

@stevekenei
Copy link

stevekenei commented Aug 20, 2021

I would like to disable a number of apps on multiple phones, right now I can disable multiple apps on a single phone running a batch script as in the screen shot attached. How can I use this code to run this on multiple apps? ie, can I run this with another .bat? Many thanks!
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment