这是我的语法:
public class Main {
public static void main(String[] args) throws InterruptedException, IOException {
frame f = new frame();
f.show();
File f = new File("D:/lala/coba");
//System.out.println("insert the username:");
// hide(f);
}
public static void hide(File src) throws InterruptedException, IOException {
// win32 command line variant
ProcessPerm p = Runtime.getRuntime().exec("cacls " + src.getPath() + " /E /C /P DINA:n");
p.waitFor(); }}
如果我想在没有写入语法的情况下更改用户“DINA”,我该怎么办?
答案 0 :(得分:1)
调用java应用程序 java Main scott
使用以下代码,用户将是scott
public class Main {
public static void main(String[] args) throws InterruptedException, IOException {
frame f = new frame();
f.show();
File f = new File("D:/lala/coba");
//System.out.println("insert the username:");
hide(f, args[0]);
}
public static void hide(File src, String user) throws InterruptedException, IOException {
// win32 command line variant
ProcessPerm p = Runtime.getRuntime().exec("cacls " + src.getPath() + " /E /C /P " + user + ":n");
p.waitFor(); }}