Java Runtime Exec for VBA script with arguments

Posted by Holograham on Stack Overflow See other posts from Stack Overflow or by Holograham
Published on 2010-05-18T17:24:44Z Indexed on 2010/05/18 17:30 UTC
Read the original article Hit count: 571

Filed under:
|

I am trying to use Runtime exec() to run a vba script with arguements. I am having trouble passing in the args. I think I need to use the String[] overloaded method for exec.

Currently this works:

String command = "cmd /c \"\\concat2.vbs\""

Process p = Runtime.getRuntime().exec(command);

But I want to run that with arguments and if I do this

String command = "cmd /c \"\\concat2.vbs\" " + arg1 + " " + arg2

where arg1 and arg2 are strings my program doesnt run (status = 1)

© Stack Overflow or respective owner

Related posts about java

Related posts about runtime.exec