Android 执行 Shell 命令 | JAVA 执行 Shell 命令 作者: Chuwen 时间: 2018-12-07 分类: Java ```java public static String execCMD(String command) { StringBuilder sb =new StringBuilder(); try { Process process=Runtime.getRuntime().exec(command); BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(process.getInputStream())); String line; while((line=bufferedReader.readLine())!=null) { sb.append(line+"\n"); } } catch (Exception e) { return e.toString(); } return sb.toString(); } ``` 标签: none