I'd like to be able to start Microsoft Edge (Chromium) with multiple tabs via a single PowerShell command in a shortcut (not a script). Here is what I have that works for one tab:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command "& start microsoft-edge:https://www.outlook.com"
but I am unclear how to add on a set of sites. Something like:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command "& start microsoft-edge:https://www.outlook.com;https://www.google.com"
That doesn't work, but I'm looking for something along those lines. Note, I do not have admin access to the workstation where I'm trying to do this.
As far as I'm aware, only a single URL is supported when you launch via the microsoft-edge:
protocol scheme.
However, you can launch Edge via the MicrosoftEdge.exe
executable located in directory $env:LOCALAPPDATA\Microsoft\WindowsApps
, which does accept multiple URLs (note the need to separate them with ,
in this case):
powershell.exe "start $env:LOCALAPPDATA\Microsoft\WindowsApps\MicrosoftEdge.exe https://example.org, https://google.com"
The above is short for (note the use of the -Command
CLI parameter and the use of Start-Process
's full name and parameter names):
powershell.exe -Command "Start-Process -FilePath $env:LOCALAPPDATA\Microsoft\WindowsApps\MicrosoftEdge.exe -ArgumentList https://example.org, https://google.com"
In fact, with an executable-based invocation you don't even need Start-Process
in this case, given that a GUI executable launches asynchronously even with direct invocation:
powershell.exe "& $env:LOCALAPPDATA\Microsoft\WindowsApps\MicrosoftEdge.exe https://example.org https://google.com"
Note the need to use &
, because the executable path contains a variable reference, and that the two URLs are now space-separated (passed as individual arguments).
Conversely, if you wanted to wait for Edge to close again before returning from the call, you would normally use Start-Process -Wait
, but this is not effective with AppX applications such as Microsoft Edge, unfortunately, at least as of PowerShell 7.3.3 - see GitHub issue #10996.