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



相关阅读:
网页设计师制作网页注意的10个技巧
防火墙及反向代理技术保护Web服务器
一些常用的JavaScript函数(json)附详细说明
ASP 改良版MD5、SHA256多重加密类(二次及多次)
wordpress去掉文章链接地址中的index.php
Linux的七个运行级别讲解
js自定义事件代码说明
Oracle安装后配置和启动企业管理器的过程
HTML5的结构和语义(4):语义性的内联元素
利用Bcdedit创建Linux系统引导
用vbscript脚本实现返回 IP 配置数据的代码
用 Net 命令使局域网文件批量同步更新
php4的彩蛋
sql语言中delete删除命令语句详解
快速导航

Copyright © 2016 phpStudy |