标题: 怎样让VBS写入大文件
[打印本页]
作者: knoppix7
时间: 2008-1-6 17:59
标题: 怎样让VBS写入大文件
sFile = "加密后的文件.exe"
str= (省略1.6W行)
Function MakeFile()
if Len(Trim(sFile)) = 0 Then Wscript.Quit
Set oStream = Createobject("Adodb.Stream")
Set oXML = Createobject("Microsoft.XMLDOM")
Set oElement = oXML.CreateElement("oTmpElement")
oElement.DataType = "bin.hex"
oElement.NodeTypedValue = str
With oStream
.Type = 1
.Mode = 3
.Open
.Write oElement.NodeTypedValue
.SaveToFile sFile
End With
oStream.Close
Set oStream = Nothing
Set oXML = Nothing
Set oElement = Nothing
End Function
就是因为str变量过大.在转换的时候一下子就把我512内存全部吃完了.
我想问问。有没有办法让他分次从文件读取str的内容然后写入(第一次以后是附加)到"加密后的文件.exe"
鄙人基本不懂VBS..
作者: knoppix7
时间: 2008-1-6 18:21
我在想是不是可以用
TextStream一次读取指定大小的文件.
然后用
Adodb.Stream
写入.
或者分段。让Adodb.Stream分段追加写入
不知道是不是个办法.
[ Last edited by knoppix7 on 2008-1-6 at 06:34 PM ]
作者: s11ss
时间: 2008-1-6 21:46
作者: kevin4000
时间: 2008-12-16 10:51
作者: slore
时间: 2008-12-16 13:19
objStream.Position = objStream.Size
然后再write
或者write多份……copy /b合并……
感觉没有必要……吧。
bin转成str浪费太多空间