ITeye博客

ubuntu linux通过adb命令行"复制粘贴"内容到android

vfate_linux · 2014-08-07 11:28 · 行业应用 · Markdown

假如你像我一样在寻找android下通过命令复制粘贴的方法,来对地方了,不过android上是没有直接进行复制粘贴剪切板的命令,只有间接实现:在电脑上直接adb输入信息到android设备上

首先android设备上,要把光标焦点定位到需要输入的文本框,比如当你输入用户名密码的时候 电脑上adb连接好android设备 电脑上执行adb命令如下,比如你的用户名是hello,密码是world

adb shell input text hello
#输入tab键定位到下一输入框,tab键的key code是61 --> "KEYCODE_TAB" 
adb shell input keyevent 61
#然后输入密码
adb shell input text world
#回车确认登录,回车键的key code是66
adb shell input keyevent 66

扩展阅读,假如你的密码比较复杂有但引号之类,比如为 wor"ld

adb shell input text wor\\\"ld

参考:http://blog.rungeek.com/post/42456936947/sending-keyboard-input-via-adb-to-your-android-device

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。