Question:
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
1 2 3 4 5 6 |
$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?
Answer:
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
$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++ } |