Hi, I have a code which use getRuntime().exec() to open the cmd and input a command string and output the expected result.
OutputStream stdin = null;
Runtime rt = Runtime.getRuntime();
Process p = rt.exec("cmd.exe");
stdin = p.getOutputStream();
line = "some command string";
The code runs fine. It will open the cmd and type the command string. However this command string will return something when I manually type on the cmd. But when I use in this way, the cmd freeze. It looked like it's waiting for something . Can anyone give me some suggestion ? Why is this happening ?