package main
import (
"os/exec"
"fmt"
"os"
)
func main() {
//cmd:=exec.Command("sh","-c","input text aa")
//cmd:=exec.Command(os.Getenv("SHELL"),"-c","input text aa55")
//cmd:=exec.Command(os.Getenv("SHELL"),"-c","input text 发电房")
//如果要输入中文需要安卓另外一个apk 下载链接见参考
cmd:=exec.Command(os.Getenv("SHELL"),"-c","am broadcast -a ADB_INPUT_TEXT --es msg '可以可以'")
bytes,err:=cmd.Output()
if err!=nil{
fmt.Println(err)
}
resp:=string(bytes)
fmt.Println(resp)
}
参考:https://blog.csdn.net/slimboy123/article/details/54140029
网友评论