package bag;
import java.io.File;
import java.io.IOException;
public class test {
public static void main(String[] args) throws IOException {
File ceshi = new File("D:\\ddd.txt");
if(!ceshi.exists()){
ceshi.createNewFile();
}
String sets = "attrib \""+ceshi.getAbsolutePath()+"\"+H";
System.out.println(sets);
Runtime.getRuntime().exec(sets);
System.out.println(ceshi.isHidden());
}
}
在网上找的创建隐藏文件的方式,但是执行结束后好像并没有效果?
结果输出时 System.out.println(ceshi.isHidden())输出的是false
求解答