android - adb shell 输入带空格的文本

标签 android shell adb

如何使用 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)

最佳答案

您可以使用 \<space> 来完成,像这样:

adb shell input text "some\ text"

关于android - adb shell 输入带空格的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45041320/

相关文章:

android - 如何获得连续的触摸事件?

android - Adb 无法在 Max OSX 10.7.2 中检测到安卓设备

linux - 如何处理 shell 脚本中的引号

linux - 启动位于子目录中的几个脚本

android - channel 不可恢复地损坏,将被处理掉

带标题的Android分类 ListView

linux - 这可以排列吗?

android - 取消设置持久系统属性

Android Studio 无法识别我的设备

android - Android手机如何通过ADB获取连接的WIFI密码