adb shell input text with space

Lava Sangeetham picture Lava Sangeetham · Jul 11, 2017 · Viewed 12.2k times · Source

How to send text with spaces like "some text" using adb shell input text ?

Found following solution

adb shell input text "some%stext" is working fine. But any easy way to replace space with %s?

Example:

$ 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)

Answer

KS Ravikumar picture KS Ravikumar · May 29, 2018

You can do it with \<space>, like this:

adb shell input text "some\ text"