文本文件的内容进行排序

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

Dim objFSO,objFile,DataList,strText
Const adVarChar = 200 
Const MaxCharacters = 255 
Const ForReading = 1 
Const ForWriting = 2 

Set DataList = CreateObject("ADOR.Recordset") 
DataList.Fields.Append "ComputerName", adVarChar, MaxCharacters 
DataList.Open 

Set objFSO = CreateObject("Scripting.FileSystemObject") 
Set objFile = objFSO.OpenTextFile("C:ScriptsComputers.txt", ForReading) 

Do Until objFile.AtEndOfStream 
strLine = objFile.ReadLine 
DataList.AddNew 
DataList("ComputerName") = strLine 
DataList.Update 
Loop 

objFile.Close 

DataList.Sort = "ComputerName" 

DataList.MoveFirst 
Do Until DataList.EOF 
strText = strText & DataList.Fields.Item("ComputerName") & vbCrLf 
DataList.MoveNext 
Loop 

Set objFile = objFSO.OpenTextFile("C:ScriptsComputers.txt", ForWriting) 

objFile.WriteLine strText 
objFile.Close