首页 电脑 电脑学堂 查看内容

vbs-mdb解包

2009-3-22 09:25 512 0

摘要:   来源:woyigui's blog  今天正好刚跟woyigui下了一站 自己有用到 收藏一份..  Dim rs, ws, fso, conn, stream, connStr, theFold...
关键词: stream thePath CreateObject Set theFolder conn connStr Nothing rs 文件

  来源:woyigui's blog  今天正好刚跟woyigui下了一站 自己有用到 收藏一份..  Dim rs, ws, fso, conn, stream, connStr, theFolder  Set rs = CreateObject("ADODB.RecordSet")  Set stream = CreateObject("ADODB.Stream")  Set conn = CreateObject("ADODB.Connection")  Set fso = CreateObject("Scripting.FileSystemObject")  connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=当前目录中mdb文件;"  conn.Open connStr  rs.Open "FileData", conn, 1, 1  stream.Open  stream.Type = 1  On Error Resume Next  Do Until rs.Eof  theFolder = Left(rs("thePath"), InStrRev(rs("thePath"), "\"))  If fso.FolderExists(theFolder) = False Then  createFolder(theFolder)  End If  stream.SetEos()  stream.Write rs("fileContent")  stream.SaveToFile str & rs("thePath"), 2  rs.MoveNext  Loop  rs.Close  conn.Close  stream.Close  Set ws = Nothing  Set rs = Nothing  Set stream = Nothing  Set conn = Nothing  Wscript.Echo "所有文件释放完毕!"  Sub createFolder(thePath)  Dim i  i = Instr(thePath, "\")  Do While i > 0  If fso.FolderExists(Left(thePath, i)) = False Then  fso.CreateFolder(Left(thePath, i - 1))  End If  If InStr(Mid(thePath, i + 1), "\") Then  i = i + Instr(Mid(thePath, i + 1), "\")  Else  i = 0  End If  Loop  End Sub   注意这一句  引用  connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=当前目录中mdb文件;"  当前目录中mdb文件;改成你的mdb文件名即可..
声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系 [邮箱地址] 删除

路过

雷人

握手

鲜花

鸡蛋

最新评论

返回顶部