VBScript Delete Duplicate

VBS script to remove duplicates in a text file in the same directory.

VBScript Delete Duplicate

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 if

Set 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
Loop

objFile.Close

Set objFile = objFSO.OpenTextFile _
(lefichier, ForWriting)

For Each strKey in objDictionary.Keys
objFile.WriteLine strKey
Next

objFile.Close

FREE

VBScript Delete Duplicate

remove-duplicates.vbs


Ludo.One

Quality tools for Webmasters !

A collection of free or paid PHP scripts and Prestashop modules. Download free and paid website scripts and tools. Each of the PHP scripts here includes complete PHP source codes

Contact Details

Phone: +33781217982
Email:
Website: www.Ludo.One