如何在Java中运行多个OS命令?我正在使用以下代码来运行OS命令:
System.out.println("Please Insert an URL ");
String https_url = input.next();
ProcessBuilder builder = new ProcessBuilder("cmd.exe", "/c", "cd \"C:\\OpenSSL\" && openssl s_client -connect "+https_url);
builder.redirectErrorStream(true);
Process pr = builder.start();
BufferedReader r = new BufferedReader(new InputStreamReader(pr.getInputStream()));
String line;
while (true)
{
line = r.readLine();
if (line == null)
break;
System.out.println(line);
}
运行上面的命令后,我需要再运行两个命令 -
如何在同一个OpenSSL窗口中运行多个命令?