2
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 to clean virus from flash drive. I have consulted some materials here in the forum, but I could not apply.
Basically the user will type the letter of your USB stick and click Run button, where 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...");
}