Link to home
Start Free TrialLog in
Avatar of bsharath
bsharathFlag for India

asked on

Add each and every web address in a txt file to the Ie favorites.

Hi,

Add each and every web address in a txt file to the Ie favorites.
i have these in a txt file
www.google.com
www.yahoo.com

Can anyone help me with a script that can add all into the favorites in my ie.

Regards
Sharath
Avatar of t0t0
t0t0
Flag of United Kingdom of Great Britain and Northern Ireland image

I can only offer you limited knowledge on this subject have spent only a few moments musing over this question and tinkering with URL files.

You need two pieces of information to create each favorites link:

   1) the name of the link
   2) the URL of the web page


STEP 1 - Create a text file (URL.TXT) containing a comma-delimited list such as:

   My Google,http://www.google.com
   My Yahoo,http://www.yahoo.com


STEP 2 - Copy the code below into notepad and save as MKURL.BAT

   @echo off
   set destination=%userprofile%\favorites
   for /f "tokens=1,* delims=," %%a in (url.txt) do (
      if not exist "%destination%\%%a.url" (
          >"%destination%\%%~a.url" echo [DEFAULT]
         >>"%destination%\%%~a.url" echo BASEURL=%%~b
         >>"%destination%\%%~a.url" echo [InternetShortcut]
         >>"%destination%\%%~a.url" echo URL=%%~b
         >>"%destination%\%%~a.url" echo IDList=
         >>"%destination%\%%~a.url" echo IconFile=
         >>"%destination%\%%~a.url" echo IconIndex=1
         >>"%destination%\%%~a.url" echo [{000214A0-0000-0000-C000-000000000046}]
         >>"%destination%\%%~a.url" echo Prop3=19,2
      )
   )


STEP 3 - Ensure both files are in the same directory then run the batch file: MKURL


This will create two files in:

   C:\Documents and Settings\...\Favorites\

in the current user's profile named:

   My Google.url
   My Yahoo.url


STEP 4 - Fire up Internet Explorer and check out the favorites.


This should get you on your way.....
SOLUTION
Avatar of Hubasan
Hubasan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
oh sorry t0t0. I wasn't aware you are helping this user already. I should really refresh the screen before posting. :-)

Well in any case bsharath if you want an alternative, my script is VBS and instructions are above.
Hubasan...

It's not a problem.... we're working from two different approaches... it'll be interesting to see which method (if not both) the asker chooses....

 
If you want to work with your original list of URLs such as:

   www.google.com
   www.yahoo.com

then save your list as URL.TXT and run the modified batch file.

   @echo off
   set destination=%userprofile%\favorites
   for /f "tokens=*" %%a in (url.txt) do (
      for /f "tokens=2 delims=." %%b in ("%%a") do (
         if not exist "%destination%\%%b.url" (
            echo [DEFAULT]
            echo BASEURL=http://%%a
            echo [InternetShortcut]
            echo URL=http://%%a
            echo IDList=
            echo IconFile=
            echo IconIndex=1
            echo [{000214A0-0000-0000-C000-000000000046}]
            echo Prop3=19,2
         )>"%destination%\%%b.url"
      )
   )


NOTE: This will create two entries in your favorites menu:

   Yahoo
   Google

by creating the following two files in your 'favorites' folder:

   Yahoo.url
   Google.url

If you want to change these entries to something like "My Yahoo" and My Google" then you need to change the following two lines:

   if not exist "%destination%\%%a.url" (

   )>"%destination%\%%b.url"

to:

   if not exist "%destination%\My %%a.url" (

   )>"%destination%\My %%b.url"

(see where I slipped the 'My ' into those lines? You can customise this if you want to)
Sorry! Re-submitted due to typo....

If you want to work with your original list of URLs such as:

   www.google.com
   www.yahoo.com

then save your list as URL.TXT and run the modified batch file.

   @echo off
   set destination=%userprofile%\favorites
   for /f "tokens=*" %%a in (url.txt) do (
      for /f "tokens=2 delims=." %%b in ("%%a") do (
         if not exist "%destination%\%%b.url" (
            echo [DEFAULT]
            echo BASEURL=http://%%a
            echo [InternetShortcut]
            echo URL=http://%%a
            echo IDList=
            echo IconFile=
            echo IconIndex=1
            echo [{000214A0-0000-0000-C000-000000000046}]
            echo Prop3=19,2
         )>"%destination%\%%b.url"
      )
   )


NOTE: This will create two entries in your favorites menu:

   Yahoo
   Google

by creating the following two files in your 'favorites' folder:

   Yahoo.url
   Google.url

If you want to change these entries to something like "My Yahoo" and My Google" then you need to change the following two lines:

   if not exist "%destination%\%%b.url" (

   )>"%destination%\%%b.url"

to:

   if not exist "%destination%\My %%b.url" (

   )>"%destination%\My %%b.url"

(see where I slipped the 'My ' into those lines? You can customise this if you want to)
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bsharath

ASKER

Thank U
Thank you....