如何使用“一些文本”使用adb shell input 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)
发布于 2018-05-29 02:16:01
您可以使用\<space>
来完成它,如下所示:
adb shell input text "some\ text"
发布于 2017-07-26 14:48:11
在安装了gnu-linux sed (或其他)之后(大多数linux机器都是预装的)--您可以使用sed来用%s替换空格。
adb shell input text $(echo "some text with spaces" | sed 's/ /\%s/g')
%符号必须用。
发布于 2017-12-06 21:10:51
你可以发送你的短信,比如:
Text = "some text with spaces"
用%s替换空格
adb shell input text some%stext%swith%sspaces
https://stackoverflow.com/questions/45041320
复制相似问题