troubleshooting Question

Vbscript - want ot compare 2 .txt line by line in a folder and output diferrences

Avatar of GlobaLevel
GlobaLevelFlag for United States of America asked on
Visual Basic Classic
5 Comments2 Solutions249 ViewsLast Modified:
hi see attached i am trying to compare 2 txt in a folder and output the differences to msgbox can t get it to work... help!
Set objArgs = Wscript.Arguments
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile1 = objFSO.GetFile(objArgs(0))
Set objFile2 = objFSO.GetFile(objArgs(1))
Set FileStream1 = objFSO.OpenTextFile(objFile1.C:\_Transfer\NWP\compare2 files\APICustomer1022-jeffs.txt)
Set FileStream2 = objFSO.OpenTextFile(objFile2.C:\_Transfer\NWP\compare2 files\APICustomer1022-russloaded.txt)
While (Not FileStream1.AtEndOfStream) Or (Not FileStream2.AtEndOfStream)
    if Not FileStream1.AtEndOfStream Then
        sLine1 = FileStream1.ReadLine()
        sLine1 = ""
    End If
    If Not FileStream2.AtEndOfStream Then
        sLine2 = FileStream2.ReadLine()
        sLine2 = ""
    End If
    If sLine1 <> sLine2 Then
        sAllLines =  sAllLines & sLine1 & chr(10) & chr(13) & sLine2 & chr(10) & chr(13) 
    End If
if sAllLines <> "" Then
    Wscript.Echo sAllLines 
End if
Join our community to see this answer!
Unlock 2 Answers and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros