Skip to content

Instantly share code, notes, and snippets.

@prachil007
Created September 22, 2018 01:28
Show Gist options
  • Save prachil007/3c8a45ca34308faafda1b41ef7d48216 to your computer and use it in GitHub Desktop.
Save prachil007/3c8a45ca34308faafda1b41ef7d48216 to your computer and use it in GitHub Desktop.
Start android emulator from command line, especially when you don`t know the AVD name
@echo off
IF [%1]==[] (GOTO ExitWithPrompt)
set i=1
FOR /F "delims=" %%i IN ('emulator -list-avds') DO (
set /A i=i+1
set em=%%i
if %i% == %1 (
echo Starting %em%
emulator -avd %em%
EXIT /B 0
)
)
GOTO :Exit
:ExitWithPrompt
emulator -list-avds
echo Please enter the emulator number to start
:Exit
EXIT /B 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment