I'm trying to read output from command.com not cmd.exe, so I've tried to go with this code:
Process p=Runtime.getRuntime().exec("command /c echo goodbye world"); //command.com doesn't work eiher
p.waitFor();
BufferedReader reader=new BufferedReader(
new InputStreamReader(p.getInputStream())
);
String line="";
String output="";
while((line = reader.readLine()) != null)
{
output+=line;
}
System.out.print(line);
Unfortunately, it doesn't print anything, but it works when I replace command with cmd perfectly. I've tried ro run 'command /c echo goodbye world' in cmd, and it works. I've tried this code in windows me and XP, because command.com doesn't exist in new windows versions.