Appium – Launching Android Emulator from Command Prompt or Batch file without Android Studio

Appium – Launching Android Emulator from Command Prompt or Batch file without Android Studio

<<Previous Post       <<Complete Tutorial>>       Next Post>>

Appium – Launching Android Emulator from Command Prompt or Batch file without Android Studio

As we already know from our previous post, that launching Android Emulator from Android Studio takes lot of time, due to the below steps:

  1. Launch Android Studio (Which takes a hell lot of time to launch)
  2. Open AVD Manger from Tools Menu
  3. Select the play option of the desired Android Emulator to launch it (Which again takes good amount of time)

In order to reduce the time taken to launch the Android Studio, we can directly launch the Android Emulator from command prompt without launching Android Studio. Hence we can reduce the time required to launch the Android Emulator in our machines.

Launching Android Emulator from Command Prompt

Lets follow the below steps  for launching Android Emulator from Command Prompt:

1)  Open Command Prompt and navigate to the path – C:\Users\<username>\AppData\Local\Android\sdk\emulator as shown in the screenshot:

Note#1 : AppData folder will be in hidden mode by default in your machine. Either enable it to view the Hidden folders in your machine or manually type AppData in the path to get there.

Note#2 : There are two way to go to the above specified path in command prompt. One way is to use cd command followed by path to get there and the other way is to manually go to the emulator folder in our machine and then execute the cmd in the displayed folder path.

Appium - Navigating to Emulators Path

2) Type and execute the command emulator.exe -avd  your_android_emulator_name

Note#1 : If your Android Emulator name is a single word say ‘Demo‘, in this case you simply run the command emulator.exe -avd  Demo

Note#2 : Else if your Android Emulator name has multiple words say ‘Pixel 3 API 28‘, in this case you you need to join these words with any symbol say _ to make it as single word and then run the command as emulator.exe -avd  Pixel_3_API_28

Appium - Launching Emulator from Command Prompt

3) Observe that the Android Emulator will launch without the need for launching the Android Emulator as shown in the above screenshot.

Launching Android Emulator from Batch file

Lets follow the below steps  for launching Android Emulator from Batch file:

1) Open a note pad file, provide any name and save it as .bat extension (Say Demo.bat)

2) Right click on the .bat file and open it using any note pad software say NotePad or Notepad++ etc., to perform the below changes:

  • > Copy the below two commands into the .bat file
    • – cd C:\Users\username\AppData\Local\Android\sdk\emulator
    • – emulator -avd emulator_name
  • > Modify the username and emulator_name with your details in the above copied commands and save the .bat file

3) Now close the .bat file after saving it and double click the .bat file to launch your Android Emulator

Next Steps:

  • > To learn more about Appium, continue to the next post (Click on Next Post Link Below)
  • > Check complete Appium Tutorial Contents here (Click here)

Please leave your questions/comments/feedback below.

Happy Learning ?

About Me > Jagadeesh Kotha

Connect to me on Linked In (Click here)

On a mission to contribute to the Software Testing Community in all possible ways.

<<Previous Post       <<Complete Tutorial>>       Next Post>>

Comments (1)

  • Hi, This is Deekshith

    I have made a batch file to launch my emulator. I have placed the file in my project.

    The name of the emulator is correct. I have double checked that.

    When I launch the bat file as an administrator it launches and the command runs and launches the emulator

    The problem is that the bat file is not getting launched without manually running it as administrator

    Appium v1.17.0
    I am automating using android emulator on Windows

    Can anybody guide me on – how to give permission to batch file for non-admin user in WIndows?

    I am using Java for this

    Runtime.getRuntime().exec(System.getProperty(“user.dir”)+ “\src\Emulatorbat”);

    Below are the contents of the batch file:
    cd C:\Users\visha\AppData\Local\Android\Sdk\emulator
    emulator -avd DeekshithEmulator

    When i double click the bat file command window opens and disappears immediately.


Leave a Reply

Your email address will not be published. Required fields are marked *

For FREE Testing Tutorials & Videos

Open chat
Contact Us on Whatsapp