VBScript Delete Duplicate
VBS script to remove duplicates in a text file in the same directory.
delete_duplicate.vbs
Const ForReading = 1
Const ForWriting = 2
lefichier= InputBox("name of text file (in the same directory):" & VBCRLF & "(Ex: ""toto.txt"")")
If (lefichier <> "") Then
WScript.Sleep 200
else
wscript.Echo "You must enter a file name (in the same directory)"
Wscript.Quit
end ifSet objDictionary = CreateObject("Scripting.Dictionary")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile _
(lefichier, ForReading)Do Until objFile.AtEndOfStream
strName = objFile.ReadLine
If Not objDictionary.Exists(strName) Then
objDictionary.Add strName, strName
End If
LoopobjFile.Close
Set objFile = objFSO.OpenTextFile _
(lefichier, ForWriting)For Each strKey in objDictionary.Keys
objFile.WriteLine strKey
NextobjFile.Close
FREE
remove-duplicates.vbs