vbs- f = "a.txt"
- fn = Left(f,instrrev(f,".")-1)
- ext = Replace(f, fn, "")
- Set fso = CreateObject("Scripting.FileSystemObject")
- Set File= fso.OpenTextFile(f, 1)
- n = InputBox("请输入按指定多少行均等分割文本",,"200")
- If CInt(n) >0 Then
- Do While File.AtEndOfStream <> True
- s = s &File.readLine&vbCrLf
- t = t+1
- If t = CInt(n) Then
- i = i+1
- fso.CreateTextFile(fn&"_"&i&ext, 2).Write s
- s = ""
- t = 0
- End If
- Loop
- Else Wscript.Quit
- End If
- File.Close
- If s <> "" Then fso.CreateTextFile(fn&"_"&(i+1)&ext, 2).Write s
- MsgBox "完成!"
复制代码
|