文本文件的内容进行排序
2012-05-19 13:04:37 来源:WEB开发网核心提示:Dim objFSO,objFile,DataList,strTextConst adVarChar = 200 Const MaxCharacters = 255 Const ForReading = 1 Const ForWriting = 2 Set DataList = CreateObject("A
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
更多精彩
赞助商链接