2012-05-07 2 views
0

나는 u에 질문하고 싶다. 내 프로젝트 파일에서 이러한 구문을 시도하고 작동합니다. 하지만이 프로그램을 좀 더 강력하게 변경하고 싶습니다. 여기구문에 형식없이 java appliacation을 사용하여 cacls에서 사용자를 hange하는 방법

내 구문 :

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"사용자를 변경하려는 경우는 어떻게해야합니까?

답변

1

전화를 다음 코드로 자바 주 스캇과 같은 자바 응용 프로그램

사용자는 스캇

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

감사의 친구가 될 것입니다. 시도해 볼게. 더 이상 문제가 발견되면 다시 도와 주시겠습니까? –

+0

예! 내가 도와주지 않는다면 항상 나보다 더 잘되고 당신을 도울 준비가 된 사람이 항상있다. P – Zecas

+0

글쎄, 나에게 당신의 가장 좋은 구문을 시도했지만, 나는 String user와 args [0]을 혼동한다. 말해 줄 수있어? –