Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for cv2urlnt.bat

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

  1. @ECHO OFF
  2. :: CNVRTURLNT.BAT, Version 3.00 for Windows NT
  3. :: Converts Microsoft Internet Explorer Favorites to Netscape Bookmarks file
  4. :: Written by Rob van der Woude
  5. :: http://www.robvanderwoude.com
  6.  
  7. :: Save initial environment
  8. SETLOCAL
  9.  
  10. :: Save initial directory
  11. FOR /F "tokens=*" %%A IN ('CD') DO SET STARTDIR=%%A
  12.  
  13. :: Go to most recent "Favorites" directory if necessary.
  14. :: If you start this batch file in a Favorites directory, this step is skipped
  15. IF EXIST *.URL GOTO Header
  16. CD /D %USERPROFILE%\FAVORITES
  17.  
  18. :Header
  19. :: If BOOKMARK.HTM already exists we'll just add the "favorites"
  20. :: to the existing file; but first we'll remove the closing tags
  21. IF EXIST BOOKMARK.HTM (
  22. 	TYPE BOOKMARK.HTM | FIND /V /I "</DL>" > BOOKMARK.TMP
  23. 	IF EXIST BOOKMARK.TMP (
  24. 		COPY BOOKMARK.HTM BOOKMARK.OLD
  25. 		DEL BOOKMARK.HTM
  26. 		REN BOOKMARK.TMP BOOKMARK.HTM
  27. 	)
  28. 	GOTO Favorites
  29. )
  30. :: Create the Bookmark file's header, using the PROMPT
  31. :: and ECHO ON technique to create the HTML tags
  32. >  BOOKMARK.HTM ECHO ^<!DOCTYPE NETSCAPE-Bookmark-file-1^>
  33. >> BOOKMARK.HTM ECHO ^<!-- This is an automatically generated file.
  34. >> BOOKMARK.HTM ECHO It will be read and overwritten.
  35. >> BOOKMARK.HTM ECHO Do not edit! --^>
  36. >> BOOKMARK.HTM ECHO ^<TITLE^>'s Bookmarks^</TITLE^>
  37. >> BOOKMARK.HTM ECHO ^<H1^>'s Bookmarks^</H1^>
  38. >> BOOKMARK.HTM ECHO.
  39. >> BOOKMARK.HTM ECHO ^<DL^>^<P^>
  40.  
  41. :Favorites
  42. FOR %%A IN (*.URL) DO FOR /F "tokens=1* delims==" %%a IN ('TYPE "%%A" ^| FIND /V /I "BASEURL=" ^| FIND /I "URL="') DO (>> BOOKMARK.HTM ECHO     ^<DT^>^<A HREF="%%b"^>%%~nA^</A^>)
  43.  
  44. :: Footer
  45. >> BOOKMARK.HTM ECHO ^</DL^>^<p^>
  46.  
  47. :: Return to initial directory
  48. CD /D %STARTDIR%
  49.  
  50. :: Restore initial environment
  51. ENDLOCAL
  52.  

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