【问题标题】:how to get command line parameters with "&"如何使用“&”获取命令行参数
【发布时间】:2015-08-24 23:03:06
【问题描述】:

我正在使用如下命令行参数运行 uiautomator,

adb shell uiautomator runtest xxx.jar -c com.xxxxx -e keyString "hereisvalue&test"

但是getParams().getString("keyString") 只得到了"hereisvalue" 而不是"hereisvalue&test","&" 中的字符已经丢失,如何获取整个字符串?

【问题讨论】:

    标签: android android-uiautomator


    【解决方案1】:

    好的,我找到了解决方案,如this, 编写一个 bash shell 来替换所有的“&”字符,

    ${param//&/0amper0}
    

    然后,在代码中替换所有这些字符串,

    getParams().getString("keyString").replace("0amper0", "&");
    

    【讨论】:

      猜你喜欢
      • 2016-05-02
      • 1970-01-01
      • 2022-01-17
      • 1970-01-01
      • 2013-08-23
      • 1970-01-01
      • 2011-09-12
      • 2021-04-08
      • 2014-06-07
      相关资源
      最近更新 更多