我在java中有这样一行代码Runtime rt = Runtime.getRuntime();
rt.exec("cmd /c xcopy " + path1+ "/e /t"+ " " + path2);该代码是将path1下的目录拷贝到path2下但是path1和path2中如果含有空格的话,将无法完成拷贝。请高手帮忙
rt.exec("cmd /c xcopy " + path1+ "/e /t"+ " " + path2);该代码是将path1下的目录拷贝到path2下但是path1和path2中如果含有空格的话,将无法完成拷贝。请高手帮忙
String p1=path1.trim(); String p2=path2.trim();
trim 不行啊, 中间的空格 怎么办 建议 replaceAll(" ","");
rt.exec("cmd /c xcopy \"" + path1+ "\" /e /t"+ " \"" + path2+"\"");