I have a folder named A that contains a .bat
file: a.bat.
If I wanted to write a .bat
file I could write:
cd A/
call a.bat
and I would see the results, but if I want to run it from Java
I have problems.
I'm trying to do this:
String command = "cmd.exe /c start cd A/\ncall a.bat";
try {
Runtime.getRuntime().exec(command);
} catch (IOException e) { }
I tried to replace \n
with ;
and with \r
and with &&
but that didn't work. (It doesn't recognize that there exist two lines).
How can I run multiple lines from a .bat
from Java
?