1

How can I enter a "!" via adb? I can't find the keycode anywhere and it isn't coming across with I use adb shell input text !

adb shell input keycode <???> 
5
  • hmm- adb shell input text ! seems to work fine for me: just to be clear, that's not working for you? Or have I misunderstood? Commented Aug 27, 2013 at 14:33
  • No, not working for me. Commented Aug 27, 2013 at 21:09
  • which version of android you are using ? Is it throwing any errors while issuing the command? I am able to enter ! character via adb shell input text ! Commented Aug 28, 2013 at 5:15
  • I checked again. It seems that the issue is when the ! is the last character run in a batch file: @echo off adb wait-for-device adb shell input text xyzabc! Commented Aug 29, 2013 at 21:44
  • This is still not working for me: adb shell input text "!1234" returns -bash: !1234: event not found Commented Apr 15, 2015 at 22:20

1 Answer 1

4

you need to escape the following characters:

( ) < > | ; & * \ ~ " ' 'escaping' means putting a backslash ( \ ) before the offending character.

space is escaped by using %s

 adb shell input text \! 

There is no keycode for !.

Sign up to request clarification or add additional context in comments.

2 Comments

escaping means putting the escape symbol before the offending character. not every OS/shell uses \ for that purpose
I also say "space is escaped by using %s" ;O) Were talking about adb shell here.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.