android - Unable to get an ADB shell command with a path working within a Windows shell
问题描述
I'm trying to get the color of a pixel from a screendump. While I can get the command to work when I use 'adb shell' first, I want to be able to run the command right from a windows shell. I've tried all the suggestions in this post, but I can't get it to work.
"C:\Program Files\Microvirt\MEmu\adb.exe" -s 127.0.0.1:21503 shell dd if='/sdcard/screen.dump' bs=4 count=1 skip=54950 2>/dev/null | hd
This returns
'the system cannot find the path specified'
If I try:
"C:\Program Files\Microvirt\MEmu\adb.exe" -s 127.0.0.1:21503 shell \"dd if='/sdcard/screen.dump' bs=4 count=1 skip=54950 2>/dev/null | hd\"
It returns:
/system/bin/sh: dd if='/sdcard/screen.dump' bs=4 count=1 skip=54950 2>/dev/null | hd not found
The sh file does exist in /system/bin/ so I have no idea what's going on.
解决方案
您无需转义"
字符即可输入命令 for adb shell
。
"C:\Program Files\Microvirt\MEmu\adb.exe" -s 127.0.0.1:21503 shell "dd if='/sdcard/screen.dump' bs=4 count=1 skip=54950 2>/dev/null | hd"
会好的。
此外,你的评论说,
该文件夹已经在我的 PATH 环境变量中。
然后,您无需指定adb
.
adb -s 127.0.0.1:21503 shell "dd if='/sdcard/screen.dump' bs=4 count=1 skip=54950 2>/dev/null | hd"
也OK。
错误信息,
/system/bin/sh: dd if='/sdcard/screen.dump' bs=4 count=1 skip=54950 2>/dev/null | 找不到高清
表示没有名为“dd if='/sdcard...null | hd”的可执行文件,但您只需要它们作为参数,而不是完整的可执行文件名称。
对于您的第一次尝试,
"C:\Program Files\Microvirt\MEmu\adb.exe" -s 127.0.0.1:21503 shell dd if='/sdcard/screen.dump' bs=4 count=1 skip=54950 2>/dev/null | hd
该命令将在 .NEThd
之外adb shell
,它将由 Windows 的命令行执行。
更新:我们可以使用od
or的参数hd
来做一些技巧。
例如,在我的设备上,busybox od
有参数[-t TYPE]
, [-A RADIX]
, [-N SIZE]
and [-j SKIP]
,然后在我的手机上我可以
adb shell od -N4 -j54950 -tx1 -Ax /sdcard/screen.dump
推荐阅读
- javascript - Jquery - 单击后按钮未禁用
- python-3.x - noLoop 是否停止执行绘制?
- python - 过滤数据框中包含某个特定字符串的行
- r - 数据框列表到绘图列表;for 循环,lapply
- sql - 查找一组行的 AVG DATEDIFF
- sql - Excel VBA - microsoft Office Access 数据引擎找不到对象
- django - 我在 django 中的 python manage.py makemigrations 期间遇到了一些错误
- reactjs - 列表中的条件渲染元素作为 React 中的模式
- c# - 如何将天数添加到日期并将总和传递给 c# 中的 inputdate?
- java - “}”此时在 quarkus 中出现意外错误