How to run one or another EXE file with input arguments?

ProcessBuilder i1 = new ProcessBuilder("file.exe"); //i1.добавитьАргумент("названиеАргумента", "значениеАргумента"); i1.start(); 

That is, if I do this using BAT files (batch), then it will look something like this:

 start file.exe +set arg1 VALUE +set arg2 VALUE 

Note: this EXE file is not written in Java language, so similar options ( Set the arguments when starting the jar ) are not suggested.

  • Perhaps you can do without ProcessBuilder'a, it does not matter. - nick
  • Start by reading the official documentation: new ProcessBuilder ("myCommand", "myArg1", "myArg2"); for example - Vladimir Martyanov

1 answer 1

 new ProcessBuilder("file.exe", "+set", "arg1", "VALUE", "+set", "arg2" "VALUE").start();