vbs实现的支持拖动的txt文本切割器
splitfile.vbs
'/*=========================================================================
' * intro .txt文本切割器,默认为8000个字符切为一个文件。支持拖动。
' * 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("选择要处理的文本文件", , "选择要处理的文本文件")
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个字符切为一个文件
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
'按指定编码存储文件
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
上一篇: Linux下安装nginx详细步骤
下一篇: 检测ip格式是否正确的批处理