Hi,
Using powershell to launch a browser and open a defined set of URLs from a notepad:
$url = Get-Content C:\Users\xadmin\Documents\Dashboard\URL.txt
Start-Process -FilePath "chrome.exe" -ArgumentList $url
This is the contents of the txt file:
This works perfectly and as expected on every browser apart from Internet Explorer.
I must use IE for my task otherwise I would have used Chrome.
Replace "chrome.exe" with "iexplore.exe", IE doesn’t open the URL lines in new tabs but thinks its ones big line of URL.
I've tried adding semi-colon after the URLs in the notepad but IE still places the whole txt file into one tab.
Pls help
Launch IE tabs based on TXT file
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Launch IE tabs based on TXT file
Internet Explorer has a command line switch to do this.
or
Start-Process 'http://www.google.com'
Specifying the URL to start will open a new tab in the currently running IE browser.
or
Start-Process 'http://www.google.com'
Specifying the URL to start will open a new tab in the currently running IE browser.
-
- Posts: 18
- Last visit: Thu Apr 18, 2019 7:07 am
Re: Launch IE tabs based on TXT file
Hi,
Thanks for the reply.
This doesn't solve my issue.
The issue is, I want to specify the URLs in a text file as the screenshot above. I do not want to hardcode the URLs in the script - only to point to a txt file containing the URLs so can modify freely.
However, asking IE to open with the URLs in the text file instead of going into each tab, instead it makes it one long URL: Using the same script on Chrome works as intended: I require this to work on IE
Thanks for the reply.
This doesn't solve my issue.
The issue is, I want to specify the URLs in a text file as the screenshot above. I do not want to hardcode the URLs in the script - only to point to a txt file containing the URLs so can modify freely.
However, asking IE to open with the URLs in the text file instead of going into each tab, instead it makes it one long URL: Using the same script on Chrome works as intended: I require this to work on IE
-
- Posts: 21
- Last visit: Sat Feb 24, 2024 5:20 am
- Has voted: 2 times
Re: Launch IE tabs based on TXT file
This should do the trick:
You get your URL data from the file, pipe it to ForEach-Object as JVierra recommended, and then execute the Start-Process cmdlet against each URL.
I'm not sure this will open them all in one Chrome instance though, it may open them in separate windows, I'm unable to verify at the moment.
- $URL = Get-Content C:\Users\xadmin\Documents\Dashboard\URL.txt
- $URL | ForEach-object { Start-Process -FilePath "chrome.exe" -ArgumentList $_ }
I'm not sure this will open them all in one Chrome instance though, it may open them in separate windows, I'm unable to verify at the moment.
J.B. Hunt
Devin Leaman
Devin.Leaman@jbhunt.com
Devin Leaman
Devin.Leaman@jbhunt.com
-
- Posts: 21
- Last visit: Sat Feb 24, 2024 5:20 am
- Has voted: 2 times
Re: Launch IE tabs based on TXT file
I can now confirm that if you have Chrome open and run the above code, it will open the pages in new tabs.
J.B. Hunt
Devin Leaman
Devin.Leaman@jbhunt.com
Devin Leaman
Devin.Leaman@jbhunt.com