Open multiple Microsoft Edge windows from batch file

3

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?

Darren

Posted 2016-06-16T11:35:05.240

Reputation: 133

I wonder if the command does not work twice because you're starting the process for Microsoft Edge, not just a window. Maybe two of those commands would work for IE, since each window is a separate process (afaik). Perhaps this will help? http://stackoverflow.com/questions/188850/how-to-launch-multiple-internet-explorer-windows-tabs-from-batch-file

– Kaizerwolf – 2016-06-16T13:31:27.967

Answers

2

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)))')

Narzard

Posted 2016-06-16T11:35:05.240

Reputation: 2 276

Unfortunately, this doesn't seem to work anymore with the latest version. – Rami A. – 2019-08-06T03:33:11.267

@RamiA. I have updated it. If it does not work still, please increase the sleep time. – Narzard – 2019-08-08T20:51:14.670

I'm on Windows 10 64-bit v1903 Build 18362.239. Running the PowerShell script just opens two tabs. The PowerShell windows outputs "False" after trying to call AppActivate. – Rami A. – 2019-08-09T02:41:04.340

Weird. If I right click the ps1 and run w powershell it works because it already has window control. When i run with the shell open as .\xx.ps1 it does what you say. I do not know why appactivate is failing. – Narzard – 2019-08-12T02:56:43.050

1

Here is an alternate technique to start multiple instances of Edge from a batch file. You can use a free 3rd-party application called EdgeLaunch.exe in your batch file (as many times as you like!)

EdgeLaunch.exe http://www.FirstInstance.com
EdgeLanuch.exe http://www.SecondInstance.com
etc...

http://www.emmet-gray.com/Articles/EdgeLaunch.html

PS: I am the author

egray

Posted 2016-06-16T11:35:05.240

Reputation: 625

1This doesn't actually open a new browser window for me, it just adds another tab to the existing window. Is there a setting in Edge that I'm missing? – lwitzel – 2019-02-09T18:12:51.260