views:

51

answers:

2

I have a text file with lots of links-each line has a link (i.e the separator is '\n'). i want to write a script so that each link opens in a different tab in Firefox or Internet explorer. How can I do this? I'm on Windows 7

+1  A: 

Create a text file called whatever.bat and put it on your desktop. edit the file and enter:

set "fileList="
FOR /F "usebackq delims==" %%i IN ("C:\Documents and Settings\mdevine\Desktop\urls.txt") DO call set "fileList=%%fileList%% %%i"
start firefox %fileList%

close and save

double click on it

Note: C:\Documents and Settings\mdevine\Desktop\urls.txt is a text file that contains the following:

http://www.rte.ie
http://www.python.org
http://www.bbc.co.uk
http://www.google.com
amadain
@amadain: each line of the txt file has a link ..so the separator is not a space
iceman
edited from previous answer. above should do what you want
amadain
A: 

@iceman, @amadain:

refining @amadains solution: the "line continuation character" in batch files is ^, so iceman should change his text files accordingly (add a ^ at the end of each line) and put "start firefox ^" at the beginning of the file . Don't know max length of command line string, though.

knb