如何使用参数在Java中执行命令?
Process p = Runtime.getRuntime().exec(new String[]{"php","/var/www/script.php -m 2"});
Run Code Online (Sandbox Code Playgroud)
不行吗?
String[] options = new String[]{"option1", "option2"};
Runtime.getRuntime().exec("command", options);
Run Code Online (Sandbox Code Playgroud)
它是否也有效,因为它没有指定"m"参数.