取り敢えず,今時の Windows であれば大体において 使えるであろう WSH のうち VBS でのスクリプト例!
ex. httplink.vbs infile outfile
------------------------------------------------------------------------------- Dim Arg Set Arg = WScript.Arguments If Arg.Count < 2 Then WScript.Quit End If
Dim Src, Dst Src=Arg(0) Dst=Arg(1)
Dim Fs Set Fs = Wscript.CreateObject("Scripting.FileSystemObject") If Not Fs.FileExists(Src) Then WScript.Echo "ファイルがありません!" Set Fs = Nothing Set Arg = Nothing WScript.Quit End If If Fs.FileExists(dst) = True Then Fs.DeleteFile dst,True End If
Set sFile = Fs.OpenTextFile(Src) Set dFile = FS.CreateTextFile(Dst)
Dim Line Set objRE = New RegExp objRE.IgnoreCase = True objRE.Global = True objRE.Pattern = "(((s?https?|ftp)://|mailto:)[-_.!~*'()a-zA-Z0-9;/?:@&=+$,%#]+)"
Do Until sFile.AtEndOfStream Line = sFile.ReadLine If Line = Chr(&h1A) Then Exit Do End If If objRE.Test(Line) = True Then Line = objRE.Replace(Line,"" + "$1" + "") End If dFile.WriteLine(Line) Loop
sFile.Close dFile.Close Set sFile = Nothing Set dFile = Nothing Set Arg = Nothing Set Fs = Nothing WScript.Quit -------------------------------------------------------------------------------