I currently have some code that executes a task:
this.cmds = new String[] { "cmd.exe", "/c", customCmd };
ProcessBuilder pb = new ProcessBuilder(cmds);
try {
pb.start();
} catch (IOException e) {
e.printStackTrace();
}
This works perfectly and does what I expected.
However, I would like to actually display a visible cmd window when running this specific task.
Is this possible?
Thanks for your time,
Benna
Use this line:
this.cmds = new String[] { "cmd.exe", "/c", "start cmd.exe /k " + customCmd };
The first "cmd.exe", "/c"
starts invisible window, but then inside you use command start cmd.exe /k ...
to create visible window and it will stay open because of /k
.