vbs 略显操蛋,原本想找找有没简单的办法,最后又绕回 ado...- [原文件] = "a.txt"
- [最大行长度] = 65535
-
- Set fso = WScript.CreateObject("Scripting.Filesystemobject")
- text = fso.OpenTextFile([原文件],1).ReadAll
-
- Set rec=CreateObject("ADODB.Recordset")
- rec.Fields.Append "String",200,[最大行长度]
- rec.Fields.Append "Length",200,Len([最大行长度])
- rec.Open
- For Each str In Split(text,vbCrLf)
- rec.AddNew
- rec.Fields("String") = str
- rec.Fields("Length") = Len(str)
- Next
-
- rec.Sort = "Length ASC"
-
- Do Until rec.EOF
- Wscript.Echo rec.Fields("String")
- rec.MoveNext
- Loop
复制代码
|