如何使用adb shell input text
发送带有空格的文本,如**“some text”**?
发现以下解决方案adb shell input text "some%stext"
工作正常。但是有没有简单的方法用%s替换空格?
示例:
$ adb shell input text "some text"
Error: Invalid arguments for command: text
Usage: input [<source>] <command> [<arg>...]
The sources are:
keyboard
mouse
joystick
touchnavigation
touchpad
trackball
dpad
stylus
gamepad
touchscreen
The commands and default sources are:
text <string> (Default: touchscreen)
keyevent [--longpress] <key code number or name> ... (Default: keyboard)
tap <x> <y> (Default: touchscreen)
swipe <x1> <y1> <x2> <y2> [duration(ms)] (Default: touchscreen)
press (Default: trackball)
roll <dx> <dy> (Default: trackball)
6条答案
按热度按时间tvmytwxo1#
你可以用
\<space>
来做,像这样:pdtvr36n2#
安装了gnu-linux sed(或其他)(大多数linux机器都预装了它)-你可以使用sed来用%s替换空格。
%符号必须用\转义。
nwo49xxi3#
你可以发送你的文本像:
将空白替换为%s
798qvoo84#
adb shell“input text 'some text'”
vvppvyoh5#
替换特殊字符的最佳方法是。
3lxsmp7m6#
用单引号括起全文: