我的java程序需要为我的程序运行的Windows桌面系统的所有用户授予对文件夹的完全访问权限。
任何提示都将受到赞赏。
答案 0 :(得分:1)
您可以使用:
File file = new File("mioFile.txt");
file.setExecutable(boolean); – true, allow execute operations; false to disallow it.
file.setReadable(boolean); – true, allow read operations; false to disallow it.
file.setWritable(boolean); – true, allow write operations; false to disallow it.
file.canExecute(); – return true, file is executable; false is not.
file.canWrite(); – return true, file is writable; false is not.
file.canRead(); – return true, file is readable; false is not.
答案 1 :(得分:0)
试试这个:
ProcessBuilder builder = new ProcessBuilder(
"cmd.exe", "/c", "cd \"C:\\Windows\\System32\" && icacls "+"\""+modifiedJavapath+"\""+ " /grant \"Users\":F ");
builder.redirectErrorStream(true);
builder.start();