You can use like this (netstat is only dummy command. you can write whatever you want) ;
String command = "cmd.exe /c start " + "netstat";
Process child = Runtime.getRuntime().exec(command);
after that you can get as data stream from child process. Or you can close the cmd also with child.destroy() method forexample.
1
solved How to commit a shell command via Java [closed]