Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for cvturlnt.bat

(view source code of cvturlnt.bat as plain text)

  1. @ECHO OFF
  2. :: CNVRTURLNT.BAT
  3. :: Version 2.00 for Windows NT
  4. :: Written by Rob van der Woude
  5. :: Converts Microsoft Internet Explorer Favorites to Netscape Bookmarks file
  6.  
  7.  
  8. :: Go to most recent "Favorites" directory if necessary.
  9. :: If you start this batch file in a Favorites directory, this step is skipped
  10. IF EXIST *.URL GOTO Header
  11. CD /D %windir%\PROFILES\%USERNAME%\FAVORITES
  12.  
  13. :Header
  14. :: If BOOKMARK.HTM already exists we'll just add the "favorites"
  15. :: to the existing file; but first we'll remove the closing tags
  16. IF EXIST BOOKMARK.HTM TYPE BOOKMARK.HTM | FIND /V /I "/DL" > BOOKMARK.HTM
  17. IF EXIST BOOKMARK.HTM GOTO Favorites
  18. :: Create the Bookmark file's header, using the PROMPT
  19. :: and ECHO ON technique to create the HTML tags
  20. PROMPT $L!DOCTYPE NETSCAPE-Bookmark-file-1$G$_
  21. ECHO ON
  22. @ECHO EXIT | COMMAND | FIND "!DOCTYPE" >> BOOKMARK.HTM
  23. @ECHO OFF
  24. PROMPT $L!-- This is an automatically generated file.$_
  25. ECHO ON
  26. @ECHO EXIT | COMMAND | FIND "--" >> BOOKMARK.HTM
  27. @ECHO OFF
  28. PROMPT It will be read and overwritten.$_Do not edit! --$G$_
  29. ECHO ON
  30. @ECHO EXIT | COMMAND | FIND "--" >> BOOKMARK.HTM
  31. @ECHO OFF
  32. PROMPT $LTITLE$G's Bookmarks$L/TITLE$G$_
  33. ECHO ON
  34. @ECHO EXIT | COMMAND | FIND "'s Bookmarks" >> BOOKMARK.HTM
  35. @ECHO OFF
  36. PROMPT $LH1$G's Bookmarks$L/H1$G$_
  37. ECHO ON
  38. @ECHO EXIT | COMMAND | FIND "'s Bookmarks" >> BOOKMARK.HTM
  39. @ECHO OFF
  40. PROMPT $_$LDL$G$LP$G$_
  41. ECHO ON
  42. @ECHO EXIT | COMMAND | FIND "DL" >> BOOKMARK.HTM
  43. @ECHO OFF
  44.  
  45. :Favorites
  46. FOR %%A IN (*.URL) DO CALL :AddURL %%A
  47.  
  48. :: Footer
  49. PROMPT $L/DL$G$Lp$G$_
  50. ECHO ON
  51. @ECHO EXIT | COMMAND | FIND "/DL" >> BOOKMARK.HTM
  52. @ECHO OFF
  53. :: Restore default PROMPT
  54. PROMPT $P$G
  55. :: End of main program
  56. GOTO :EOF
  57.  
  58. :AddURL
  59. :: Parameter is *.URL file name
  60. FOR /F "TOKENS=1,2* DELIMS== " %%A IN ('FIND /I "URL=" %1') DO SET PROMPT=    $LDT$G$LA HREF="%%B"$G%1$L/A$G$_
  61. ECHO ON
  62. @ECHO EXIT | COMMAND | FIND "A HREF=" >> BOOKMARK.HTM
  63. @ECHO OFF
  64. GOTO :EOF
  65.  

page last uploaded: 2017-04-06, 13:33