Solved

Need vbscript to compare text files

Posted on 2004-09-14
4
1,161 Views
Last Modified: 2012-06-27
I need a vbscript to compare a text file with a list of serial numbers as follows:

Textfile1
12345
23456
23457

and

Textfile2
12345
23456
etc...

If they are equal then exit
if they are Not equal then i will send and e-mail ( i have the e-mail script)

One list will be the constant, and the other will warn of changes.
0
Comment
Question by:chris_v
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 5

Accepted Solution

by:
tzxie2000 earned 500 total points
ID: 12058414
how about a compare textfile function below
public function comparetextfile(byval srcfilename as string,byval desfilename as string) as bool
{
      Try
            ' Create an instance of StreamReader to read from a file.
            Dim srcsr As StreamReader = New StreamReader(srcfilename)
            Dim dessr As StreamReader = New StreamReader(desfilename)
            Dim linesrc As String,linedes as string
            Do
                linesrc = sr.ReadLine()
                linedes=sr.readline()
                if(linesrc!=linedes) Exit do
            Loop Until linesrc Is Nothing or linedes is nothing
            srcsr.close()
            dessr.Close()
            if(linesrc is nothing and linedes is nothing) return true;
            return false;
        Catch E As Exception
            ' Let the user know what went wrong.
            Console.WriteLine("The file could not be read:")
            Console.WriteLine(E.Message)
        End Try
        return false
}
0
 
LVL 2

Author Comment

by:chris_v
ID: 12059992
Found another solution..  thanks
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

687 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question