Runtime 无法执行多个cmd命令问题

来源:互联网 发布:淘宝卖家信誉等级查询 编辑:程序博客网 时间:2024/06/07 03:06

解决方案:

            Runtime runtime = Runtime.getRuntime();  
            Process proc = runtime.exec("sh");
            DataOutputStream os = new DataOutputStream(proc.getOutputStream());
            os.writeBytes("su\n");
            os.writeBytes("./deviceinfo  > /data/test.txt\n");
            os.writeBytes("exit\n");
            os.flush();


0 0