I\'m developing a Java application that will be run on a Windows computer occasionally. At some point I need to run a Cygwin prompt and performs some commands in it.
If you do not need to show a console on the screen, that is easy. You have some simple steps to follow :
Process via `Process cmd = new ProcessBuilder("cmd.exe").start();cmd.getOutputStream()cmd.getInputStream() and/or cmd.getErrorStream()cmd.getOutputStream(), and if necessary kill the process by cmd.destroy()Optionnaly, you can have output and error stream to be merged :
Process cmd = new ProcessBuilder("cmd.exe").redirectErrorStream(true).start();
then you simply ignore cmd.getErrorStream() and only read from cmd.getInputStream()