Been trying to open multiple url's in ie browser through powershell script
Currently my code is working In chrome browser, how can i achive the same in ie explorer
$urls=gc "C:actual path of the url folder\url.txt"
foreach($url in $urls){
start-process chrome.exe $url
}
Can anyone help me on this?
I think this can help you :
This next code open with default web browser :
$urls = @("https://stackoverflow.com/","https://www.google.com/","https://www.thomasmaurer.ch/2017/02/open-website-from-powershell/")
foreach($url in $urls){
Start-Process $url
}
This next open in iexplorer :
$urls = @("https://stackoverflow.com/","https://www.google.com/","https://www.thomasmaurer.ch/2017/02/open-website-from-powershell/")
foreach($url in $urls){
# Start-Process "C:\Program Files (x86)\Internet Explorer\iexplore.exe" $url
Start-Process iexplore.exe $url
}
Look at thoses link : https://www.thomasmaurer.ch/2017/02/open-website-from-powershell/
**
** Note in Internet Explorer the start process doesn't add new Url (at new tab) to existing instance off IE . If you want to open all urls in same instance off IExplorer you have to try other code and see thoses post :
Open tab in existing IE instance
https://superuser.com/questions/208883/using-powershell-to-open-several-tabs-on-start-up
You can replace the part with "chrome.exe" in your code with iexplore and it should work.
EDIT: Since the original solution opened links in multiple windows, I have created an updated script that tries to open all the links in same browser window.
$IE = new-object -ComObject "InternetExplorer.Application"
$urls= gc "FILEPATH"
$count=1
foreach ($url in $urls){
if ($count -eq 1){
$IE.navigate($url,1)
}
else{
$IE.navigate($url,2048)
}
$count++
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With