android-utils

Small Windows console tools for Android development.

install-apk

Installs .apk files on connected devices through adb.

install-apk.cmd app-debug.apk                    # one device: installs right away
install-apk.cmd                                  # newest .apk in current folder
install-apk.cmd build\*.apk -AllDevices          # every connected device
install-apk.cmd app.apk -Serial emulator-5554 -AllowDowngrade -GrantPermissions

You can also drag .apk files onto install-apk.cmd in Explorer.

With two or more devices connected it asks which one to use:

2 devices connected:
  [1] OnePlus PLU110 (Android 16)        Wi-Fi     adb-3B665Q00JXB00000-k5AAKR (2)._adb-tls-connect._tcp
  [2] motorola moto g31(w) (Android 12)  Wi-Fi     adb-ZY22G82WF7-57csgf._adb-tls-connect._tcp
  [A] all devices
  [Q] cancel
Select device(s), e.g. 1 or 1,2:

Explorer integration

Double-click register-shell.cmd (current user only, no admin) to add Install on Android device for .apk files:

It does not change the default app for .apk. It points at the current folder, so re-run it after moving the repo. Remove with register-shell.cmd -Uninstall.

Optionadb flagMeaning
-Serial <id>-sTarget device. Falls back to ANDROID_SERIAL, then a picker if several are connected
-AllDevicesInstall on every ready device
-AllowDowngrade-dAllow a lower versionCode
-GrantPermissions-gGrant all runtime permissions
-AllowTestPackages-tAllow testOnly APKs
-AdbPath <file>Explicit adb.exe
-WsaInstall on Windows Subsystem for Android (starts it if needed)
-WsaPort <n>WSA adb port, default 58526

WSA (Windows Subsystem for Android)

Enable WSA Settings > Advanced settings > Developer mode once, and accept the "Allow USB debugging" prompt the first time.

adb is looked up in this order: -AdbPath, PATH, ANDROID_HOME, ANDROID_SDK_ROOT, %LOCALAPPDATA%\Android\Sdk. Existing installs are always replaced (-r). Exit codes: 0 ok, 1 an install failed, 2 setup error (no adb, no device, missing APK).