我想问你。我已经在我的项目文件中尝试过这些语法,并且它有效。 但是,我想把这些程序改得更强大。
这是我的语法:
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应用程序 java 主斯科特
使用以下代码,用户将为 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(); }}
关于java - 如何使用 java 应用程序在 icacls 中挂起用户而无需输入语法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10480180/