我正在尝试使用adb从MAC PC处理设备中的文件。
我手机中的一个文件夹中有一个空格,因此我环顾四周并尝试使用转义符\,即也使用了引号,如下所示
import java.io.*;
public class TestModule {
public static void main(String[] args) throws IOException,InterruptedException {
String line = "null";
String cmd = "adb pull /storage/sdcard1/Android/data/files/test\\ Information/ /Users/sbc/Desktop";
Runtime run = Runtime.getRuntime();
Process pr = run.exec(cmd);
BufferedReader buf = new BufferedReader(new InputStreamReader(pr.getInputStream()));
while ((line=buf.readLine())!=null) {
System.out.println(line);
}
}
}
我在终端中运行了相同的命令,我可以访问该文件,但是通过java,它给了我远程对象不存在的错误。
相关分类