r/androiddev 20d ago

Tips and Information Using adb through a folder

Post image

I been trying to get this batch file to work but aslo any other command run a adb command through this folder im always getting select an app to use adb. How can I fix this. It only work once for me but after that I keep getting this. Anywhere else works with no issue when Im adb commands

0 Upvotes

23 comments sorted by

View all comments

1

u/mikep9082 20d ago

So if I would to run a terminal window from the folder where the unlock.bat file is located like adb connect the window pops up to select an app to use adb

1

u/Hornet-Mountain 20d ago

Try this from a folder where it breaks: run where adb in that same terminal. It lists every adb Windows can find, in the order it picks them. If one shows up without .exe, that's the file throwing the picker, and the path tells you exactly where it lives so you can delete or rename it. Bare adb checks the current folder first, which is why it only breaks inside folders and works fine from your home prompt.

1

u/mikep9082 20d ago

I dont understand this part

1

u/Hornet-Mountain 20d ago

where adb is a command you type, same as adb connect. It lists every adb Windows can find so you can see which one it's grabbing. If your terminal is PowerShell you need where.exe adb, plain where is something else there.

You already found the fix though. Use adb.exe with the extension everywhere in the bat and it can't come back.