SplitFile.vbs
'/*=========================================================================
'*Intro.txt文本切割器,默认为8000个字符切为一个文件。支持拖动。
'*FileNameSplitFile.vbs
'*Authoryongfa365
'*Versionv1.0
'*MadeTime2008-04-2412:58:43
'*LastModify2008-04-2412:58:43
'*==========================================================================*/
SetobjArgs=WScript.Arguments
IfobjArgs.Count=0Then
IIIIIInputBox("选择要处理的文本文件",,"选择要处理的文本文件")
Else
ForI001=0ToobjArgs.Count-1
IIIIIobjArgs(I001)
Next
EndIf
FunctionIIIII(Path)
TempStr=ReadFromFile(Path,"gb2312")
Length=Len(TempStr)
iii=0
ForII=0ToLengthstep8000'8000个字符切为一个文件
iii=iii+1
WriteToFileLeft(Path,Len(Path)-4)&"_"&Right("00"&iii,3)&".txt",Mid(TempStr,II+1,8000),"gb2312"
Next
EndFunction
FunctionReadFromFile(FileUrl,CharSet)
DimStr
Setstm=CreateObject("Adodb.Stream")
stm.Type=2
stm.mode=3
stm.charset=CharSet
stm.Open
stm.loadfromfileFileUrl
Str=stm.readtext
stm.Close
Setstm=Nothing
ReadFromFile=Str
EndFunction
'按指定编码存储文件
FunctionWriteToFile(FileUrl,Str,CharSet)
Setstm=CreateObject("Adodb.Stream")
stm.Type=2
stm.mode=3
stm.charset=CharSet
stm.Open
stm.WriteTextStr
stm.SaveToFileFileUrl,2
stm.flush
stm.Close
Setstm=Nothing
EndFunction