i want to run a program command with window command prompt. i have to specify the path of the program before i can execute my command. i have seen other SO question but most answer only have command without path.
try {
Runtime rt = Runtime.getRuntime();
String str ="C:/Rsync/rsync -v -e ssh /cygdrive/c/test/from.zip zulkifli@address:/home/zulkifli/test/"; //put path and command
//i put path and command to str string but this will return error
Process process = Runtime.getRuntime().exec(new String[]{"cmd.exe", "/c",str});
rt.exec("cmd.exe /c start command");
System.out.println(str);
} catch (Exception ex) {}
if we do manually from command prompt we can insert path with cd path/.. and then input the command.
but how does we program it with java? below is the error when i execute the program. the command is legal when i run at cmd

cdyou can invoke rsync using absolute path and use ProcessBuilder for passing in multiple parameters to cmd.