相关疑难解决方法(0)

如何用参数执行命令?

如何使用参数在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"参数.

java parameters exec runtime.exec

24
推荐指数
2
解决办法
4万
查看次数

在Java Runtime Exec中使用重定向运算符

我有这个字符串,我在Windows XP的JVM中使用Runtime.exec().

String cmd = encoderFull + " " + "-i " + originalFull + " "+ "-bitrate" + " " + bitrateVBR[i] + " " + "-bvhq"+ " " + "-avi " + outputFull + " " + "2>&1" + " " + "1>"+ outputFile + ".txt";

不幸的是'2>&1 1> output.txt'不起作用.其余的都没问题.有没有办法使用命令,以便创建此文件?

再见,大卫

java windows

1
推荐指数
1
解决办法
1628
查看次数

标签 统计

java ×2

exec ×1

parameters ×1

runtime.exec ×1

windows ×1