Search code examples
windowsbatch-filecmdadb

How to connect to adb using a batch file?


I want to create a batch file which will open command prompt and connect to adb after changing the directory. My current code opens command prompt and change the directory but does not executes the last command of connecting to adb. If anyone can help me in this direction, it would be great.

@ECHO OFF
cmd.exe /K "cd C:\Users\SAM\AppData\Local\Android\sdk\platform-tools"
adb connect 192.168.200.25:5555

Solution

  • cmd /k starts a command prompt process that runs a command and does not quit afterwards. Why are you using cmd.exe at all?

    @echo off
    cd /d c:\users\sam\appdata\local\android\sdk\platform-tools\
    adb connect 192.168.200.25:5555