I have a batch file located at C:\app\stuff\dostuff.bat
that does stuff to the file system based on the arguments you provide it with. When I open a command line, and run it like so, it works perfectly fine:
C:\app\stuff\dostuff.bat zombies
Like I said, this invocation works perfectly (and properly handles the zombies
arg). However, I am now trying to drive the execution of dostuff.bat
from inside a Java app like so:
try {
Process process = Runtime.getRuntime().exec("C:\\app\\stuff\\dostuff.bat zombies");
process.waitFor();
} catch (IOException|InterruptedException e) {
logger.error(ExceptionUtils.getFullStackTrace(e));
}
When I run this, I get no exceptions, but it is clearly not properly executing the batch script (I can tell this because the rest of the file system that the batch script touches doesn't get modified like it should). Am I invoking this incorrectly? Do I need to do something with forking processes? How might I debug?