I tried to execute a multiple commands in a single command line prompt. Here i need to hide to directories. I used this command "C:\Windows\System32>cacls C:\Users\FSSD\Desktop\test1 /e /c /d %username% & cacls C:\Users\FSSD\Desktop\test3 /e /c /d %username% & cacls C:\Users\FSSD\Desktop\test3 /e /c /d %username%)"in commad prompt it executed well, when i use this code in my java Program it doesn't work completely. The first command will be executed.
In my java code i used this command like this,
Runtime runtime = Runtime.getRuntime();
try {
Process process = runtime
.exec("cmd.exe /c start cacls C:/Users/FSSD/Desktop/test1 /e /c /d %username%) " + "&"+
" cacls C:/Users/FSSD/Desktop/test2 /e /c /d %username%" +"&"+
" cacls C:/Users/FSSD/Desktop/test3 /e /c /d %username%");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
in this what mistake i done, else any other possible to achieve this..