This VBS Script will allow you to browse for a text file and will remove or strip all of the duplicates from it and then rewrite the original text file.
VBS Script:
Const ForReading = 1
Const ForWriting = 2
Set objDialog = CreateObject("UserAccounts.CommonDialog")
objDialog.Filter = "Text Files|*.Txt"
intResult = objDialog.ShowOpen
If intResult = 0 Then
Wscript.Quit
Else
strFileName = objDialog.FileName
End If
Set objDictionary = CreateObject("Scripting.Dictionary")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strFileName, ForReading)
Do Until objFile.AtEndOfStream
strName = objFile.ReadLine
If Not objDictionary.Exists(strName) Then
objDictionary.Add strName, strName
Loop
objFile.Close
Set objFile = objFSO.OpenTextFile(strFileName, ForWriting)
For Each strKey in objDictionary.Keys
objFile.WriteLine strKey
Next
MsgBox "Done"
No Comments