a me funzionano perfettamente sia questa:
codice:
public static void main (String[] args) {
String cmd = "cmd /k \"D:\\Programmi\\MySQL\\MySQL Server 5.1\\bin\\mysqldump.exe\" -uuser "+
"-ppassword -r C:\\Users\\Andrea\\Desktop\\javadump.txt test";
try {
Runtime.getRuntime().exec(cmd);
}
catch (Exception e) {
e.printStackTrace();
}
}
che senza cmd /k
codice:
public static void main (String[] args) {
String cmd = "\"D:\\Programmi\\MySQL\\MySQL Server 5.1\\bin\\mysqldump.exe\" -uuser "+
"-ppassword -r C:\\Users\\Andrea\\Desktop\\javadump.txt test";
try {
Runtime.getRuntime().exec(cmd);
}
catch (Exception e) {
e.printStackTrace();
}
}
non ho provato se va anche con la breve ">" e file di destinazione.
Funziona egregiamente anche con / al posto del backslash escapato.