Good people, I would like to know how to execute this command in Java:
attrib -R -A -S -H /S /D I:\*.*
This program is for cleaning pendrive viruses. I already consulted some materials here in the forum, but could not apply.
Basically the user will type the letter of his pendrive and click on the execute button, where he will do the commands below.
String cmd, caminho,comando_01,comando_02;
String[] executar;
//************************************************
cmd = "cmd /c"; // chamada para o cmd
caminho = txtCaminhoTelaDois.getText() + ":"; //pegando caminho digitado
comando_01 = "attrib -R -A -S -H /S /D" + caminho + "\*.*";
comando_02 = "del *.lnk";
executar = new String[2];
executar[0] = cmd + " " + caminho;
executar[1] = cmd + " " + comando_02;
//************************************************
Runtime comando = Runtime.getRuntime();
try {
Process proc = comando.exec(executar);
JOptionPane.showMessageDialog(null, "Concluído");
}
catch (IOException ex) {
Logger.getLogger(TelaDois.class.getName()).log(Level.SEVERE, null, ex);
JOptionPane.showMessageDialog(null, "Deu ruim...");
}