Windows Scripting
  Home arrow Windows Scripting arrow Reading Text Files in WSH
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Actuate Whitepapers 
Moblin 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
WINDOWS SCRIPTING

Reading Text Files in WSH
By: Nilpo/Developer Shed Staff Writer
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 5
    2007-01-23

    Table of Contents:
  • Reading Text Files in WSH
  • Reading methods
  • More methods
  • Advanced concepts

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
    Iron Speed
     
    ADVERTISEMENT

    AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th -1:00PM EST. Register Today!

    Reading Text Files in WSH


    (Page 1 of 4 )

    No matter what type of scripting you do, it seems like you always have a need to work with text files.  Whether you’re monitoring files or maintaining a log, reading and writing text files is a must.  WSH is no different.  It provides several methods for making your life easier.  It even provides a few that you may not have expected.  Let’s take a look.

    Text files have many different uses: data storage, logging, and program configurations just to name a few.  Sometimes this is done in an unformatted text file like a raw data dump or simple log file; sometimes it’s formatted like comma- and tab-delimited files; and sometimes it’s structured like INF files.  In any of these cases, the one thing that remains the same is that we are working with plain text.

    While the methods provided by WSH only allow us to work with plain text files, the use of third party controls can allow us to work with formatted files such as Microsoft Word documents.

    Let’s begin by creating a plain text file to work with.  We’ll create a sample data file that contains comma-delimited addresses.  Each record is on a new line.  For simplicity I’m not going to add a header record.  Many files will include one.  This is just a line that contains the title of each column.

    John Doe,1 Main Street,New York

    Jill Murphy,27 1/2 Broad Street,Miami

    Jack Robertson,3245 Maple Ave.,San Francisco

    Sam Jackson,165 S 134th Street,New Haven

    Robert Smith,495 Rural Route 2,Knoxville

    Now save your text file as C:\addresses.txt.

    More Windows Scripting Articles
    More By Nilpo/Developer Shed Staff Writer


       · I continue to explore the world of WSH with the first of a 3-part series dealing...
     

    WINDOWS SCRIPTING ARTICLES

    - Understanding Procedures in VBScript
    - Printing Documents in WSH
    - Generating Outlook Signatures Based on Activ...
    - VBScript: Converting and Formatting with Fun...
    - VBScript: Conversion and Format Functions
    - VBScript: Array Functions
    - VBScript: Strings, You Can`t Function withou...
    - VBScript: More String Functions
    - VBScript: Functioning with Strings
    - Working with the Windows Registry in C++
    - Understanding Objects
    - HTML Applications: Giving WSH a User Interfa...
    - Modifying Computer Objects with Active Direc...
    - Logon Script to Send Email Notifications
    - Securing Computers and Active Directory





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway