将*.MDB的文件放在本地的某个文件夹,把下面代码写进记事本,保存为unpack.vbs文件,把待解压文件改名为HYTop.mdb后执行解压。把VB脚本文件和MDB文件放在一个目录里,执行VB脚本就行了(双击这个脚本)。稍等几分钟时间,完成之后会提示的。(没有完成强行退出解的是不完整的包) unpack.vbs
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=HYTop.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 |