如何使用 Java 应用程序在 CACL 中挂起用户,而无需键入语法



我想问你。 我已经在我的项目文件中尝试了这些语法,它有效。 但是,我想改变这些程序以使其更强大。

这是我的语法:

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",我该怎么办?

像这样调用java应用程序爪哇主斯科特

使用以下代码,用户将是斯科特

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(); }}

相关内容

最新更新