I was trying to execute the batch file from java. My requirement is when the java execute the batch file, the command window should open. currently nothing happen.
My code is:
String[] batchArg = {"cmd", "/k", "cd /d C:\\<path to batch file> & <batchfilename>.bat",a[1],arr[2]};
Runtime.getRuntime().exec(batchArg);
also try this:
String[] batchArg = {"cmd","C:\\<path to batch file> & <batchfilename>.bat",a[1],arr[2]};
Runtime.getRuntime().exec(batchArg);
I have tried /C as well
if i run the batch file from start menu with this command or by double click it is executing correctly.
please let me know,
thanks in advance
a? What isarr? What are the contents of your batch file? Is it possible that your batch file is so simple that it runs very fast and you miss it?