我正在尝试运行2 cmd
个命令,以便从tshark
启动cmd
。
能否帮我理解为什么这段代码不起作用?
Process p = Runtime.getRuntime().exec("cmd.exe");
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(p.getOutputStream()));
writer.write("cd C:/Program Files/Wireshark");
writer.flush();
writer.write("tshark.exe -i 1 -p -a duration:60 -w C:/Users/User/Desktop/AutomatedProtocolsPcapsCreator/CreatedPcaps/fileName.pcap");
writer.flush();