Open multiple Microsoft Edge windows from batch file

batch filemicrosoft-edge

I need to open 2 Edge windows from a batch file (not two tabs, 2 windows). I know I can launch edge using the following command:

start microsoft-edge:

But if I try it twice the second command does nothing. If I try it with URLs I get 2 tabs in the same window. e.g.

start microsoft-edge:http://google.com
start microsoft-edge:http://bing.com

Any ideas how to get 2 separate windows?

Best Answer

Might be an easier way, but I just sent a keystroke for CTRL+N for a new window before sending the next start command. This works for me. (save as a .ps1 for powershell)

start microsoft-edge:http://google.com 
$wshell = New-Object -ComObject wscript.shell;
$wshell.AppActivate('Google - Microsoft Edge')
Sleep 2
$wshell.SendKeys('(^(n))')
Sleep 2
start microsoft-edge:http://yahoo.com 

The app.activate line where it says "Google - Microsoft Edge" will need to be replaced with your first websites title window text. Hovering over the edge icon at the bottom of the screen with only that website open will tell you what it is.

**Edit working version as of 8/8/2019

start microsoft-edge:http://google.com 
start microsoft-edge:http://yahoo.com 
$wshell = New-Object -ComObject wscript.shell;
$wshell.AppActivate('Google - Microsoft Edge')
Sleep 2
$wshell.SendKeys('(^(+(n)))')
Related Question