How to open a local HTML file in a new window in Edge? I tried the code below, but the HTML file opened in the same window in a different tab. I need to open the HTML file in a separate window. please do the needful
Process p = rt.exec("cmd.exe /C start \"C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe" C:\\MyView.html");
CodePudding user response:
ProcessBuilder is not a terminal emulator. You don't need cmd.exe
. You can run msedge.exe
directly.
I first searched Google for microsoft edge command line options which led me to:
Get list of Edge command line switches
and that led me to:
List of Chromium Command Line Switches
and that contained:
--new-window
So the minimal code required is:
ProcessBuilder pb = new ProcessBuilder("C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe",
"--new-window",
"C:\\MyView.html");
try {
pb.start();
}
catch (IOException xIo) {
xIo.printStackTrace();
}