How could you change the permissions for a file in a DOS environment using the Windows CACLS command by calling it from within a Java program using Runtime.exec()? I used this code
String command2=
"cmd.exe /c CACLS E:\\temp\\temp.txt /G dev\\john.doe:w";
Process process2= runtime.exec(command2);
process2.waitFor();
System.out.println("Exit value : "+ process2.exitValue());
but the command needs Y/N while executing from DOS but from Java I could not send it so the process hangs!
Expert's answern/a |