Const ForReading = 1, ForWriting = 2, ForAppending = 8, CreateIfNeeded = true
Set objFSO = CreateObject("Scripting.FileSystemObject")

outpath = ".\url\"
bookmarkfile = "bookmarks.html"
Set bookmarks = objFSO.OpenTextFile(bookmarkfile, ForReading)

Set regEx = New RegExp
regEx.Global = True
regEx.Pattern = "<DT><A HREF=""(.*)"" ADD_DATE.*>(.*)</A>"

Set regEx2 = New RegExp
regEx2.Global = True
regEx2.Pattern = "[^a-zA-Z0-9-_.]"

Set regEx3 = New RegExp
regEx3.Global = True
regEx3.Pattern = "<DT><A HREF=""(.*)"" ADD_DATE.*>(.*)</A>"

do until bookmarks.AtEndOfStream
  line = bookmarks.readline()
  if regEx.test(line) then
    shortcut = regEx.Replace(line,"$1")
    ' shortcut = Replace(shortcut, " ","")
    filename = trim(regEx.Replace(line,"$2"))
    filename = Regex2.Replace(filename, "_")
    filename = outpath & left(filename, 80) & ".url"
    ' wscript.echo filename
    'the following skips invalid filenames, you should add a routine to filter out invalid filename characters in your codeset
    on error resume next
    Set objFile = objFSO.OpenTextFile(filename, ForWriting, CreateIfNeeded)
    if err.number <> 0 then
      wscript.echo err.description
    end if
    objFile.write "[InternetShortcut]" & vbcrlf & "URL=" & shortcut
    objFile.close
  end if
loop
