如直接执行Runtime.getRuntime().exec("ls > /sdcard/1.txt");会得到一个IOExeception;因为exec不能加入重定向和管道符号。改成如下方法就可以了。String[] cmd = { "sh", "-c", "ls > /sdcard/1.txt " }; Runtime.getRuntime().exec(cmd);