Script to compare two files
' From the book "Windows XP Cookbook"
' ISBN: 0596007256
' ------ SCRIPT CONFIGURATION ------
strFile1 = "file1" ' e.g. c:\scripts\test1.vbs
strFile2 = "file2" ' e.g. c:\scripts\test2.vbs
' ------ END CONFIGURATION ---------
set objFSO = CreateObject("Scripting.FilesystemObject")
set objFile1 = objFSO.opentextfile(strFile1,1)
set objFile2 = objFSO.opentextfile(strFile2,1)
arrFile1 = split(objFile1.ReadAll,vbNewLine)
arrFile2 = split(objFile2.ReadAll,vbNewLine)
objFile1.close
objFile2.close
if ubound(arrFile1) < intlinecount =" ubound(arrFile1)" strerror =" strFile2"> ubound(arrFile2) then
intLineCount = ubound(arrFile2)
strError = strFile2 & " is bigger than " & strFile1
else
intLineCount = ubound(arrFile2)
end if
for i = 0 to intLineCount
if not arrFile1(i) = arrFile2(i) then
exit for
end if
next
if i < (intLineCount + 1) then WScript.Echo "Line " & (i+1) & " not equal" WScript.Echo strError elseif strError <> "" then
WScript.Echo strError
else
WScript.Echo "Files are identical."
end if
Showing posts with label text compare. Show all posts
Showing posts with label text compare. Show all posts
Wednesday, March 12, 2008
Subscribe to:
Posts (Atom)