首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >带有空格的adb shell输入文本

带有空格的adb shell输入文本
EN

Stack Overflow用户
提问于 2017-07-11 17:42:09
回答 5查看 15.8K关注 0票数 11

如何使用“一些文本”使用adb shell input text这样的空格发送文本?

找到以下解决方案

adb shell input text "some%stext"工作很好。但是用%s?替换空间的任何简单方法

示例:

代码语言:javascript
运行
复制
$ 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)
EN

回答 5

Stack Overflow用户

回答已采纳

发布于 2018-05-29 02:16:01

您可以使用\<space>来完成它,如下所示:

代码语言:javascript
运行
复制
adb shell input text "some\ text"
票数 17
EN

Stack Overflow用户

发布于 2017-07-26 14:48:11

在安装了gnu-linux sed (或其他)之后(大多数linux机器都是预装的)--您可以使用sed来用%s替换空格。

代码语言:javascript
运行
复制
adb shell input text $(echo "some text with spaces" | sed 's/ /\%s/g')

%符号必须用。

票数 7
EN

Stack Overflow用户

发布于 2017-12-06 21:10:51

你可以发送你的短信,比如:

代码语言:javascript
运行
复制
Text = "some text with spaces"

用%s替换空格

代码语言:javascript
运行
复制
adb shell input text some%stext%swith%sspaces
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45041320

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档