vbs-mdb解包
可能有人会用到,自己以后也会用到,收集起来:
<br />Dim rs, ws, fso, conn, stream, connStr, theFolder <br />Set rs = CreateObject("ADODB.RecordSet") <br />Set stream = CreateObject("ADODB.Stream") <br />Set conn = CreateObject("ADODB.Connection") <br />Set fso = CreateObject("Scripting.FileSystemObject") <br />connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=当前目录中mdb文件;" <br />conn.Open connStr <br />rs.Open "FileData", conn, 1, 1 <br />stream.Open <br />stream.Type = 1 <br />On Error Resume Next <br />Do Until rs.Eof <br /> theFolder = Left(rs("thePath"), InStrRev(rs("thePath"), "\")) <br /> If fso.FolderExists(theFolder) = False Then <br /> createFolder(theFolder) <br /> End If <br /> stream.SetEos() <br /> stream.Write rs("fileContent") <br /> stream.SaveToFile str & rs("thePath"), 2 <br /> rs.MoveNext <br />Loop <br />rs.Close <br />conn.Close <br />stream.Close <br />Set ws = Nothing <br />Set rs = Nothing <br />Set stream = Nothing <br />Set conn = Nothing <br />Wscript.Echo "所有文件释放完毕!" <br />Sub createFolder(thePath) <br /> Dim i <br /> i = Instr(thePath, "\") <br /> Do While i > 0 <br /> If fso.FolderExists(Left(thePath, i)) = False Then <br /> fso.CreateFolder(Left(thePath, i - 1)) <br /> End If <br /> If InStr(Mid(thePath, i + 1), "\") Then <br /> i = i + Instr(Mid(thePath, i + 1), "\") <br /> Else <br /> i = 0 <br /> End If <br /> Loop <br />End Sub<br />
转载请注明:woyigui's blog [http://www.woyigui.cn/]
本文标题:vbs-mdb解包
本文地址:http://www.woyigui.cn/2008/04/06/vbs-mdb-unpacked/
最新评论