How to use ADB Shell when Multiple Devices are connected? Fails with error: more than one device and emulator
Use the -s
option BEFORE the command to specify the device, for example:
adb -s 7f1c864e shell
See also http://developer.android.com/tools/help/adb.html#directingcommands
adb error: more than one device - android
I got it
C:\Users\MBH>adb devices -l
List of devices attached
0123456789ABCDEF device product:ZEN model:ZEN device:ZEN
0123456789ABCDEF device product:full_gs702c model:M757 device:gs702c
Then I could use the model number for shelling
C:\Users\MBH>adb -s model:M757 shell
shell@gs702c:/ $ ls
it works now
How to display my device Infomation on cmd(using adb)
You need to grep the values returns by adb shell getprop
as in here.
For each value, you can set it in a variable, and then print it with the format you want.
Example:
model=$(adb shell getprop | grep model | cut -d ":" -f 2)
# Or, simpler
model=$(adb shell getprop ro.product.model)
echo "model='${model}'"
The OP 강승오 adds in the comments:
I got app ver from '
adb shell dumpsys package mypackage | grep"'versionName="
' and I checked I want to displayApp ver : 1.2.345
but, displayed on resultApp ver : versionName=1.2.345
.
how to solve this?
I triedset str
commandset str:%str:versionName=:%
after then nothing displayed on app verapp ver :
(blank).
If you have set that result to a variable, you can replace the part you don't want:
res=$(adb shell dumpsys package mypackage | grep"'versionName=")
res=${res/versionName=/}
echo "res='${res}'
adb shell check if screen is on windows cmd
Found solution
@echo off
cd /d "C:\Program Files (x86)\Remote\adb"
setlocal
for /f "delims= tokens=1*" %%a in ('adb shell dumpsys power ^| findstr.exe "mWakefulness=Asleep"') DO (
for /f "delims== tokens=2*" %%S in ("%%a") do (
if "%%S" == "false" (goto move1) else (goto move2)
)
)
:move1
goto end
:move2
start /MIN cmd /c adb shell input keyevent 26
goto end
:end
exit
Related Topics
Android - Out of Memory Exception When Creating Bitmap
Why Are Most UI Frameworks Single Threaded
How to Integrate Opencv Manager in Android App
How to Make Gradient Background in Android
How to Add a Library (Android-Support-V7-Appcompat) in Intellij Idea
Get the Uri of an Image Stored in Drawable
Error Referencing an Inner Class View in Layout/Main.Xml
How to Add an Android Studio Project to Github
Scale Factor for Xxhdpi Android
Android Studio - Unable to Merge from Svn Branch
How to Detect the Swipe Left or Right in Android
How to Add an Image on Edittext
Android - Application (Apk) Maximum Size
Install an APK File from Command Prompt