如何在Edge的新窗口中打开本地HTML文件?我尝试了下面的代码,但HTML文件在同一窗口的不同选项卡中打开。我需要在单独的窗口中打开HTML文件。
Process p = rt.exec("cmd.exe /C start \"C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe" C:\\MyView.html");
h4cxqtbf1#
ProcessBuilder不是终端模拟器。您不需要cmd.exe。您可以直接运行msedge.exe。我首先在Google中搜索microsoft edge命令行选项,然后找到:Get list of Edge command line switches这让我想到:List of Chromium Command Line Switches其中包括:
cmd.exe
msedge.exe
--new-window
因此,所需的最少代码为:
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(); }
1条答案
按热度按时间h4cxqtbf1#
ProcessBuilder不是终端模拟器。您不需要
cmd.exe
。您可以直接运行msedge.exe
。我首先在Google中搜索microsoft edge命令行选项,然后找到:
Get list of Edge command line switches
这让我想到:
List of Chromium Command Line Switches
其中包括:
因此,所需的最少代码为: