【问题标题】:How to input ampersand with adb shell input?如何使用 adb shell 输入来输入与号?
【发布时间】:2023-04-03 11:20:02
【问题描述】:

adb shell input text "&" 不起作用,adb shell input keyevent KEYCODE_AMPERSAND 也不起作用。

question 7789826相关。

【问题讨论】:

  • 这些都行吗? adb shell input text ^&, adb shell input text "^&".
  • adb shell "input text \&"
  • 我也在使用 Arch Linux 和 bash,Paresh 的回答对我有用。如果它不适合你,我不知道为什么不......也许我们有不同版本的 Android 或 adb。我正在运行 Cyanogenmod 11。我可以稍后在我的另一部装有 Android 4.1 的手机上尝试。
  • adb shell input text "\&" 在我的两部手机上都可以使用。
  • adb 1.0.32,CyanogenMod 11-20141008-SNAPSHOT-M11-hammerhead,Android 4.4.4

标签: android input adb keyboard-events


【解决方案1】:

试试:

adb shell input text "\&"

【讨论】:

  • 无论我添加多少反斜杠,这也不起作用。
  • 它适用于我的 Linux。您使用的是什么操作系统? @AlexHenrie
  • @S.Morgenstern Windows 8
  • 适用于我在 Ubuntu/zsh 和 Android M 上。您需要双重转义字符串的原因是 there are two shells: your shell, and the adb shell
【解决方案2】:

对于以后遇到这个问题的人来说,我最终成功的逃脱不是\&,而是“\&”

adb shell echo Macaroni "\&" Cheese

不是

adb shell echo Macaroni \& Cheese

希望这对某人有所帮助。

为了记录,这是在 Windows 上。

【讨论】:

  • 感谢 Anthony 的回答,欢迎来到 StackOverflow!
猜你喜欢
  • 1970-01-01
  • 2011-12-09
  • 1970-01-01
  • 1970-01-01
  • 2014-08-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多