+ 2
what is the equivalent method to call a cmd command in Java?
for example, in c++ it's system("a command"); after including <cstdlib>. also in python after importing subprocess it's, subprocess.call(["cmd.exe","a command here"]) does anyone know how to call it in Java?
2 Réponses
+ 2
You can use "Runtime.getRuntime().exec()", which returns a Process object. You can also use the ProcessBuilder: "Process p = new ProcessBuilder("Command", "Arg", " arg2").start();"
+ 1
thank you so much Moritz i'll try it now