Splitfile. vbs
'/* =================================================== ==========================================
'* Intro. TXT text cutter. The default value is 8000 characters, which is partitioned into one file. Drag is supported.
'* Filename splitfile. vbs
'* Author yongfa365
'* Version V1.0
'* Madetime 2008-04-24 12:58:43
'* Lastmodify 2008-04-24 12:58:43
'* ===================================================== ============================================= */
Set objargs = wscript. Arguments
If objargs. Count = 0 then
Iiiii inputbox ("select the text file to be processed", "select the text file to be processed ")
Else
For i001 = 0 to objargs. Count-1
Iiiii objargs (i001)
Next
End if
Function IIIII (PATH)
Tempstr = readfromfile (path, "gb2312 ")
Length = Len (tempstr)
IIi = 0
For II = 0 to length step 8000 '8000 characters into a file
IIi = III + 1
Writetofile left (path, Len (PATH)-4) & "_" & right ("00" & III, 3 )&". TXT ", mid (tempstr, II + 1, 8000)," gb2312"
Next
End Function
Function readfromfile (fileurl, charset)
Dim Str
Set STM = Createobject ("ADODB. Stream ")
STM. type = 2
STM. mode = 3
STM. charset = charset
STM. Open
STM. loadfromfile fileurl
STR = STM. readtext
STM. Close
Set STM = nothing
Readfromfile = Str
End Function
'Store files according to the specified Encoding
function writetofile (fileurl, STR, charset)
set STM = Createobject ("ADODB. stream ")
STM. type = 2
STM. mode = 3
STM. charset = charset
STM. open
STM. writetext STR
STM. savetofile fileurl, 2
STM. flush
STM. close
set STM = nothing
end function