Redirect WScript.Echo Output

Posted on 2005-05-11
Last Modified: 2010-12-09
New to scripting, how can I redirect the output from a message box to a file?  The following code displays a message box for each element of the array.  I'd like to capture it in a file.

WScript.Echo "Members:"
For Each strMember in arrMemberOf
  WScript.Echo strMember

Thank you
Question by:MariaHalt
    LVL 14

    Accepted Solution

    You can use these lines in order to write to a text file:


      Set fso = CreateObject("Scripting.FileSystemObject")
      Set file = fso.CreateTextFile("c:\newfile.txt", True)
      file.WriteLine whatever


    Replace "whatever" with any text you want to write!

      Nayer Naguib

    Author Comment

    Perfect!  Thank you!!!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Suggested Solutions

    This article is filled with multiple code samples and explanations for mathematical calculations. They are as follows: 1. General tips 2. Quadratic formula 3. Object collision 4. Projectile path General Tips       Here are some of my tips f…
    INTRODUCTION We all know how to code. But at times you simply want to insert a common code block into your existing code and amend it as per your requirements. This tool not only saves you time but also saves you the pain of typing it all out aga…
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    758 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

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now