切尔西足总杯,维基解密 维基百科,夫妇驾驶途中激情难耐致车祸
而windows下没有一个现存的比较好用的分割工具,所以我用vbs做了一个文本文件的分割工具,和各位网友共享。脚本代码如下:
option explicit
'这个脚本只用来分割文本文件,脚本需要3个参数
'参数列表
'文件名 参数1 参数2
'梦想工作室 www.mx111.com
'示例 参数1 参数2 参数意义
' s 5 等分为5个文件
' e 1024 按照1024的大小分割文件
' f 1024 取最前面的1024字节存为一个文件
' l 1024 取最后面的1024字节存为一个文件
dim tf,sf,fname,soufile,desfolder ,soption , snum , fso , fs, sfs
if wscript.arguments.count < 3 then
wscript.echo "参数有误!"
wscript.quit
else
soufile = wscript.arguments(0)
soption = wscript.arguments(1)
snum = wscript.arguments(2)
end if
set fso = createobject("scripting.filesystemobject")
set tf=fso.getfile(soufile)
fs = tf.size
set tf = fso.opentextfile(soufile, 1)
dim x
select case soption
case "s"
sfs = int ( fs / snum )
for x=1 to snum-1
savesubfile "file_" & x &".txt", 0 ,sfs
next
savesubfile "file_" & snum &".txt", 0 , fs - sfs * (snum-1)
case "e"
sfs = snum
snum = int ( fs / sfs) + 1
for x=1 to snum-1
savesubfile "file_" & x &".txt", 0 ,sfs
next
savesubfile "file_" & snum &".txt", 0 , fs - sfs * (snum-1)
case "f"
savesubfile "file_" & 0 &".txt", 0 , snum
case "l"
savesubfile "file_" & 0 &".txt", fs - snum , snum
end select
tf.close
sub savesubfile(s,b,l)
dim sfile,content
wscript.echo s & ":" & b &":" & l
set sfile = fso.createtextfile(s, true)
if b>0 then
tf.skip(b)
end if
content = tf.read(l)
sfile.write(content)
sfile.close
end sub
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!!
点击进行留言回复
相关文章:
-
-
-
-
-
-
用vbs实现文本循环读取
因为测试中需要读取一批url数据进行浏览,其实使用qtp本身的table能实现多种读取方式,但是因为需要tabel是使用excel保存的,在没有...
[阅读全文]
-
-
-
-
-
网友评论