本帖最后由 wc726842270 于 2012-11-6 05:06 编辑
唉,写了个VBS,没有什么通用性,想要实到的话,代码怎么也得80行左右,上火- Set fso=CreateObject("scripting.filesystemobject")
- If fso.fileexists("e:\a.txt") Then
- Set ofile=fso.OpenTextFile("e:\a.txt",1)
- Else
- wscript.echo "the file is not exists"
- WScript.Quit(1)
- End If
- str=ofile.readall
- arr=Split(str,vbCrLf)
- nfile=UBound(arr)/10+1
- nnum=0
- For i=1 To nfile
- If Not fso.FileExists(i&".txt") Then
- Set newfile=fso.OpenTextFile(i&".txt",2,True)
- Else
- WScript.Echo i&".txt file is exists"
- WScript.Quit(2)
- End If
- number=0
- For n=nnum To uBound(arr)
- number=number+1
- If (ofile.AtEndOfStream And number<>10) Then
- newfile.WriteLine arr(n)
- Else
- Exit for
- End If
- Next
- nnum=i*10
- newfile.Close
- Set newfile=nothing
- Next
- ofile.Close
- Set fso=Nothing
复制代码 PS:只是玩一下,练习而以 |