Sign in to follow this  

Get Chrome to open pages from a list in .txt

This topic is 2823 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys. I was just curious, is it possible for you to save a bunch of url's in a text file and then get Chrome to somehow read that file, and open the pages based on the links in a new tab per link?

Share this post


Link to post
Share on other sites
If you're using Windows, you can easily achieve this using WSH. Save the following into a file somewhere with a .js extension then drag and drop the text file onto it.

if (WScript.Arguments.length != 1) {
WScript.Echo('No file specified.');
WScript.Quit(1);
}

var wsh = WScript.CreateObject('WScript.Shell');
var fso = WScript.CreateObject('Scripting.FileSystemObject');

var file = fso.OpenTextFile(WScript.Arguments(0));
while(!file.AtEndOfStream) {
var url = file.ReadLine();
if (url) wsh.Run(url);
}
file.Close();

It'll open the links in whatever your default browser is.

Share this post


Link to post
Share on other sites
Alternatively, most browsers allow you to pass more than one url on the command line.

You could do this the same way benryves suggested except by creating a single line like:

chrome "url1" "url2" "url3"

or you could use batch to do exactly what benryves suggsted too:

FOR /F "tokens=*" %%A IN ('myurls.txt') DO (
START Chrome %%A
)

Share this post


Link to post
Share on other sites

This topic is 2823 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this